CodePeek
Practice / ArraysBack to CodePeek

JavaScript Mutation & return values: Push, then peek

Puzzle 6 of 15 · Mutation & return values

Trace an array push followed by join. Predict the method’s return value and the contents read by the next console log. Choose an output below, then check the explanation. No signup needed. Browse puzzles by topic →

Arrays / Mutation & return valuesJavaScript
const items = ["a", "b"];
console.log(items.push("c"));
console.log(items.join("-"));

Predict the console output. Each line is a separate log.

What’s the output?

Choose the output

Starter puzzles 15