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 different functional component in javascript?

456


What will be the output of the following statements?

502


What is the use of a weakmap object in javascript?

474


How do I use javascript to password-protect my web site?

485


What is a module in javascript?

585






Explain function hoisting in javascript?

484


How to convert json object to string?

569


Why global variables are bad javascript?

481


What is called variable typing in javascript?

520


How many days it will take to learn javascript?

467


Explain the role of deferred scripts in javascript?

467


What is javascript and its advantages?

537


How do you create array in javascript?

516


What is Unobtrusive JavaScript & Why it's Important?

553


How to access an external javascript file that is stored externally and not embedded?

600