Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.InternationalDomestic
In this question, the candidate needs to implement a function
customUnshift that mimics the behaviour of
unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.
const array = [1, 2, 3]; array.unshift(4, 5); // prints [4,5,1,2,3] console.print(array);
unshift(element0) unshift(element0, element1) unshift(element0, element1, /* … ,*/ elementN)
The elements to add to the front of the arr.
length property of the object upon which the method was called.
Start the timer, complete your solution, and test it against the testcases provided by the platform. Ideally, you should finish this question within 30 mins. Share your solution with us -- https://twitter.com/devtoolstech