const arr = ["This", "Little", "Piggy"]; const first = arr.slice(0, 1); const the_rest = arr.slice(1);console.log(first); // ["This"] console.log(the_rest); // ["Little", "Piggy"]
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter