Consider following snippet:

var colors = ["red ","blue ","green ","pink "];
colors.pop();
colors.push("orange");
console.log(colors);
What will be printed to the console?
Explanation
array.pop() removes the last element in array and return that element. array.push() method add new element to array.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes