Puzzle 9 of 15 · slice vs splice
Trace slice and splice on the same array of letters. Predict both logs by following the returned copy and any changes to the original. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →
1const letters = ["a", "b", "c"]; 2console.log(letters.slice(1).join("")); 3letters.splice(1, 1); 4console.log(letters.join(""));
Predict the console output. Each line is a separate log.
bc ac
b ac
bc abc
ac bc