in JavaScript by
Which one of the following options is the correct output for the given code of JavaScript?

var values=["Three","two","one"];  



a) One

b) two

c) three

d) error

1 Answer

0 votes

Answer: C

Reason: The "shift()" method used in the given code is one of the predefined method in JavaScript. This method is used to remove the data elements from the beginning and return it along with the new length of array. We can say that the "shift()" method works like the "pop" method except it removes the data element from the starting of array unlike the "pop" which removes from the end of the array.

Related questions

0 votes
asked Mar 22, 2021 in JavaScript by Robindeniel
0 votes
asked Mar 24, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986