Q. What will be the output obtained by "shift ()" in the given code of JavaScript?

Code:
var a =[];  
a.unshift(5);  
a.unshift(22);  
a.shift();  
a.unshift(3,[4,5]);  
a.shift();  
a.shift();  
a.shift();  
  • (A) Exception is thrown
  • (B) [4,5]
  • (C) [3,4,5]
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 5

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
277
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Yashika
Publisher
πŸ“ˆ
97%
Success Rate