Tell us what’s happening:
They say use spice to splice to make a new array with elements that sum to 10.
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
// Only change code below this line
// they say the answer is:
arr.splice(1,4);
// but if you do that, the array becomes arr = [4,5,1,7] which sums to 17 not 10
// Only change code above this line
console.log(arr);
Describe your issue in detail here.
Your code so far
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
// Only change code below this line
arr.splice(1,4);
// Only change code above this line
console.log(arr);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
They want the resulting array to sum up to 10. as far as I can tell, the resulting array according to their answer, is [4, 5, 1, 7] which sums to 17, not 10.