📜  数组打字稿代码示例中的增量元素

📅  最后修改于: 2022-03-11 14:48:33.800000             🧑  作者: Mango

代码示例1
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);