← Back to challenges

Fix the Bug: Simple Array Manipulation

JavaScriptMediumbugsarrayslanguage_fundamentals

Instructions

Help fix all the bugs in the function incrementItems! It is intended to add 1 to every element in the array!

Examples

incrementItems([0, 1, 2, 3]) ➞ [1, 2, 3, 4]

incrementItems([2, 4, 6, 8]) ➞ [3, 5, 7, 9]

incrementItems([-1, -2, -3, -4]) ➞ [0, -1, -2, -3]

Notes

Make sure to read every line carefully.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Drinks Allowed?