Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // What might go wrong with the following code
- let inputs = [1, 2, 3, 4, 5, 6, 7]
- let filtered = [];
- inputs.forEach((curInput, i) => {
- if (curInput % 2) {
- inputs[i] = curInput * 4
- }else{
- inputs.splice(i, 1)
- filtered.push(curInput);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement