var data = [ "X" ];data.push( "S" );data.push( "D", "E" );What is result of data?
The push() method adds new items to the end of an array and returns the new length.
Note: The new item(s) will be added at the end of the array and the method changes the length of the array.
Tip: Using the unshift() method we can add items at the beginning of an array.
array.push(item1, item2, ..., itemX)
Add a new item to an array:
The output is as below:
var data = [ "X" ];data.unshift( "S" );data.unshift( "D", "E" ); What is result of data?
var data = [ "X", "Y", "Z" ];data.pop(); What is the output of this code?
var data = [ "X", "Y", "Z" ];data.shift(); What is the output of this code?