Q:

Write a JavaScript program to find all elements in a given array except for the first one. Return the whole array if the array's length is 1

0

Write a JavaScript program to find all elements in a given array except for the first one. Return the whole array if the array's length is 1.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const tail = arr => (arr.length > 1 ? arr.slice(1) : arr);
console.log(tail([1, 2, 3])); 
console.log(tail([1]));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now