Javascript Array Object - RJM Programming - June, 2015
var myarray = new Array(); var sparearray = new Array(); var sparestring = ''; // and then?
myarray.push('1');
myarray.push('2');
myarray.push('3','5','13','17','2','7','11');
myarray.push('7','9','8');
myarray=myarray.concat('17','19','18');
sparestring=myarray.join(','); alert('sparestring=' + sparestring);
sparestring=myarray.shift(); alert('sparestring=' + sparestring);
sparestring=myarray.pop(); alert('sparestring=' + sparestring);
myarray.unshift('2','1');
myarray.reverse();
myarray.sort();
myarray.sort(numericalsort);
myarray.splice(0,1,99);
sparearray=myarray.slice(0,myarray.length); alert('sparearray=' + sparearray);
sparearray=myarray.slice(onerand(0),tworand(myarray.length)); alert('sparearray=' + sparearray);
sparestring=myarray.indexOf('1'); alert('sparestring=' + sparestring);
sparestring=myarray.lastIndexOf('2'); alert('sparestring=' + sparestring);
sparestring=myarray.every(isalleven); alert('sparestring=' + sparestring);
sparestring=myarray.every(isallprime); alert('sparestring=' + sparestring);
sparestring=myarray.some(isallprime); alert('sparestring=' + sparestring);
myarray.forEach(showmemberdata);
sparearray=myarray.map(showalphasort); alert('sparearray=' + sparearray);
sparearray=myarray.filter(isallprime); alert('sparearray=' + sparearray);
myarray.reduce(showmemberdatawithprevious);
myarray.reduceRight(showmemberdatawithfollowing);
sparestring=myarray.toString(); alert('sparestring=' + sparestring);
sparestring=myarray.toLocaleString(); alert('sparestring=' + sparestring);
sparestring=myarray.length; alert('sparestring=' + sparestring);
myarray.push('1');
myarray.push('2');
myarray.push('3','5','13','17','2','7','11');
myarray.push('7','9','8');
myarray=myarray.concat('17','19','18');
sparestring=myarray.join(','); alert('sparestring=' + sparestring);
sparestring=myarray.shift(); alert('sparestring=' + sparestring);
sparestring=myarray.pop(); alert('sparestring=' + sparestring);
myarray.unshift('2','1');
myarray.reverse();
myarray.sort();
myarray.sort(numericalsort);
myarray.splice(0,1,99);
sparearray=myarray.slice(0,myarray.length); alert('sparearray=' + sparearray);
sparearray=myarray.slice(onerand(0),tworand(myarray.length)); alert('sparearray=' + sparearray);
sparestring=myarray.indexOf('1'); alert('sparestring=' + sparestring);
sparestring=myarray.lastIndexOf('2'); alert('sparestring=' + sparestring);
sparestring=myarray.every(isalleven); alert('sparestring=' + sparestring);
sparestring=myarray.every(isallprime); alert('sparestring=' + sparestring);
sparestring=myarray.some(isallprime); alert('sparestring=' + sparestring);
myarray.forEach(showmemberdata);
sparearray=myarray.map(showalphasort); alert('sparearray=' + sparearray);
sparearray=myarray.filter(isallprime); alert('sparearray=' + sparearray);
myarray.reduce(showmemberdatawithprevious);
myarray.reduceRight(showmemberdatawithfollowing);
sparestring=myarray.toString(); alert('sparestring=' + sparestring);
sparestring=myarray.toLocaleString(); alert('sparestring=' + sparestring);
sparestring=myarray.length; alert('sparestring=' + sparestring);
myarray =