📜  js高阶函数示例 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:24.539000             🧑  作者: Mango

代码示例1
function copyArrayAndManipulate(array, instructions) {
  const output = []
  for(let i = 0; i < array.length; i++) {
    output.push(instructions(array[i]))
  }
  return output
}

function multiplyBy10(input) {
  return input * 10
}

copyArrayAndManipulate([1, 2, 3], multiplyBy10)