increment elements in array typescript

Solutions on MaxInterview for increment elements in array typescript by the best coders in the world

showing results for - "increment elements in array typescript"
Mayron
20 Aug 2020
1let numbers: number[] = [1, 2, 3, 4, 5];
2
3function addNumbers(i: number): number {
4  let sum: number = (numbers[i] += 1);
5
6  return sum;
7}
8
9let add: number = addNumbers(2);
10
11console.log(add);
12