Interviewer And Interviewee Guide

Expert Developer JavaScript Interview Question:

Explain the unshift() method in JavaScript?

Submitted by: Administrator
This method is functional at the starting of the array, unlike the push(). It adds the desired number of elements to the top of an array. For example -


var name = [ "john" ];
name.unshift( "charlie" );
name.unshift( "joseph", "Jane" );

console.log(name);

The output is shown below:

[" Jane ", " joseph ", " charlie ", " john "]
Submitted by:

Read Online Expert Developer JavaScript Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.