How to shift and unshift using javascript?
Answer / Aakriti Sharma
The shift() method removes the first element from an array and returns that element. The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array. For example: var arr = [1, 2, 3]; arr.shift(); // removes 1 and returns 1, arr.unshift(0); // adds 0 at the beginning and returns 4
| Is This Answer Correct ? | 0 Yes | 0 No |
How do you create array in javascript?
What are the difference between undefined and not defined in javascript?
What is the Infinity property used for in Javascript?
What is JavaScript?
What will be the output of the following code? //nfe (named function expression) var Foo = Function Bar() { return 7; }; typeof Bar();
Why is javascript used for web pages?
What are the uses of javascript in web page designing?
What is Javascript namespacing? How and where is it used?
Is it possible make a call to server side event of any button using javascript?
what is the purpose of using jsp?
Which is better for or foreach in javascript?
What are the primitive data types in JavaScript?