Can't seem to get the accurate position to splice it

Tell us what’s happening:
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

// Only change code above this line
console.log(arr);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 9; TECNO CC9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36

Challenge: Remove Items Using splice()

Link to the challenge:

Is there more to the question? What you’re being asked to do here is to look at the array, see which elements somewhere in the center interfere with summing to 10. You’re being asked to splice the array together, removing some elements from the middle of it.

The implied hint is the “middle of it” bit - so you will likely have the first and last thing remaining: [2, /* something */, 1]. Now, looking at the array, do you see a few consecutive values near one end or the other that sum to the remaining value?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.