What is a way to append a value to an array?

Answer Posted / venkateswaran

We can append a value in a array using two methods
1.push() - add elements in end of the array
2.unshift() - add elements in begining of the array.

For example;
var arr = new Array(3);
arr[0] = "Venkat";
arr[1] = "Sathya";
arr.push("Meena")

Is This Answer Correct ?    23 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the most popular javascript library?

626


How to get inner html of an element in javascript?

688


Is everything in javascript asynchronous?

646


How to modify the url of the page without reloading the page?

682


What is dhtml in javascript?

661


What is the difference between call & apply?

678


What is the difference between test () and exec () methods?

852


What does trim stand for?

668


How to delete an array entry using javascript?

629


Why is javascript so hard?

638


How to you change the title of the page by javascript?

703


What does the enableviewstatemac setting in an aspx page do?

696


What is the default data type in javascript?

692


How can javascript be used to improve the "look and feel" of a web site? By the same token, how can javascript be used to improve the user interface?

700


What is the difference between the operators ‘==‘ & ‘===‘?

661