Increment Array Elements

ARRAY

Problem

Given an array of integers array, return a new array where each element is increased by 1.

Examples

incrementElements([1, 2, 3]); // returns [2, 3, 4] incrementElements([4, 5, 6]); // returns [5, 6, 7] incrementElements([0, -1, 5]); // returns [1, 0, 6] incrementElements([-5, -3, -1]); // returns [-4, -2, 0]
Loading...