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 global variables in javascript?

531


Explain what is pop()method in JavaScript?

668


What is a nan value?

499


How are DOM utilized in JavaScript?

679


What is closure? Give an example.

523






What is the difference between local storage & session storage?

479


Explain spread operator in javascript?

494


What is let keyword in typescript?

546


What is double exclamation point?

524


What is question mark in javascript?

496


What is the use of ‘debugger’ keyword in javascript code?

503


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

498


What is a good javascript editor?

504


Why javascript is so popular?

458


Write the code for adding new elements dynamically?

602