Tell us what’s happening:
So,my code is not meeting the requirement below:
arr should only contain elements that sum to 10
Can someone please guide me on getting through this challenge?
Your code so far
const arr = [2, 4, 5, 1, 7, 5, 2, 1];
// only change code below this line
function sumOfTen(arr) {
// change code below this line
arr.splice(1, 5);
//console.log(arr);
// change code above this line
}
// only change code above this line
console.log(arr);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0
.
Challenge: Remove Items Using splice()
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice