You can assign variables from arrays like this:
arr = [1, 2, 8]
first, , last = arr
first = lst[0]
last = lst[arr.length - 1]
console.log(first) ➞ outputs 1
console.log(last) ➞ outputs 8
Using Destructuring Assignment, your task is to unpack the arrays writeyourcodehere into three variables, first, a variable to ignore all middle values and last.
Your solution should be just One Line of code.
Another version of this challenge.