increment elements in array typescript

The solution for “increment elements in array typescript” can be found here. The following code will assist you in solving the problem.

let numbers: number[] = [1, 2, 3, 4, 5];

function addNumbers(i: number): number {
let sum: number = (numbers[i] += 1);

return sum;
}

let add: number = addNumbers(2);

console.log(add);

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in