The _.rest()
function from the Underscore library in JavaScript is used to get a new array with all the elements of the original array except for the first one. Here's how you can use it:
index.tsx346 chars12 lines
In the example above, we imported the Underscore library using the require()
function, then defined an array of numbers. We used the _.rest()
function to get a new array with all elements except the first one and stored it in a new variable. Finally, we logged the new array to the console using console.log()
.
gistlibby LogSnag