Q:

Write a JavaScript program to remove specified elements from the left of a given array of elements

0

Write a JavaScript program to remove specified elements from the left of a given array of elements.

All Answers

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

function remove_from_left(arr, n = 1){
  return arr.slice(n); 
}
console.log(remove_from_left([1, 2, 3]));
console.log(remove_from_left([1, 2, 3], 1));
console.log(remove_from_left([1, 2, 3], 2));
console.log(remove_from_left([1, 2, 3], 4));

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