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

Answers were Sorted based on User's Feedback



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

Answer / narasimhan

We can use push() method to add an element in an array in
its last node.

Is This Answer Correct ?    25 Yes 3 No

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

Answer / 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

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

Answer / dr. shveta

arr[arr.len]=newValue;

Is This Answer Correct ?    17 Yes 4 No

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

Answer / gayathri

its a way to append a value to an array
arr[arr.length] = value;

Is This Answer Correct ?    4 Yes 7 No

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

Answer / shailendra shukla

String AnswerArray[];

AnswerArray=new String[50];

Int Index=1;

AnswerArray[Index]=Test;

Is This Answer Correct ?    5 Yes 11 No

Post New Answer

More JavaScript Interview Questions

What is an object in javascript, give an example?

0 Answers  


How to reload a page using JavaScript?

0 Answers  


Is python better than javascript?

0 Answers  


How is javascript different from java?

0 Answers  


How to go next field without filling the text? Which function should we use?

4 Answers  






what difference between args.length and args.length() in command line argument?

0 Answers  


What is the disadvantage of using innerhtml in javascript?

0 Answers  


What does triple dot mean?

0 Answers  


What is strict mode in javascript?

0 Answers  


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

0 Answers  


What are javascript functions?

0 Answers  


What are local variables in javascript?

0 Answers  


Categories