Javascript Array splitInThree()
/*/* w ww. j a va 2 s . c o m*/ Chunks an array into smaller arrays of three elemets so that it can be displayed in a 3-column table. */ Array.prototype.chunk = function splitInThree(){ var array = this; var ret = []; var temp = []; for(var i = 0; i < array.length; i++){ temp.push(array[i]); if(temp.length > 2){ ret.push(temp); temp = []; } } if(temp.length > 0){ ret.push(temp); } return ret; } function getDateTimeString(date){ var date = new Date(date); return date.toDateString() + " " + date.toLocaleTimeString(); };