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 are the four basic data structures in javascript?

746


how can we retrieve value from one database server and store them another database server using sql server code

1816


Explain the difference between “==” and “===”?

771


Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?

796


Is there an alternative to javascript?

656


Why does the browser display the slow script warning?

751


What is the use of debugger keyword in javascript?

692


What is the difference between ‘function declaration’ and ‘function expression’?

744


How about 3+5+"8"?

785


What is s+ in regex?

738


How do I get javascript?

694


Can you access Cookie using javascript?

762


What do I need to code javascript?

706


What is a name function in javascript?

735


What is event in javascript?

697