hello, can anybody explain me how to append the value of array in javascript? is this any function is their for that?
[SIZE=+1]We can append a value to an array using one of the two methods shown below1.push() - add elements in end of the array2.unshift() - add elements in begining of the array.For example;int limit=2;string[] arrsize = new string[limit];arrsize[0] = "java";arrsize[1] = "jsp";arrsize.push("j2ee")[/SIZE]
Sample code var msgArray = new Array(3); msgArray[0] = "Welcome to"; msgArray[1] = "forums"; msgArray[2] = "DigitalPoint"; msgArray .push("Hola"); for (var i = 0; i < msgArray.length; i++) { alert(msgArray ); };