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

Explain prototypal/differential inheritance?

565


What are global variables in javascript?

631


How do I add a javascript event handler to an html page element?

552


What is bom?

579


What is difference between deep and shallow object coping in javascript?

609






What is difference == and === in javascript?

580


What e means?

583


What does the isNaN() function?

638


What does "1"+2+3 evaluate to?

634


How to loop through array in javascript?

556


What is break and continue statements?

589


What is the default scope in javascript?

513


How to create an array in javascript?

639


How to use strings as array indexes using javascript?

612


How to replace all occurrences of a string in JavaScript?

594