📜  对于每个函数 javascript 代码示例

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

代码示例4
//Am goinmg to practice the next big thing, using for.each function yo tripple iontegers in an array :)
  //for.each function is used to run a command on each number or string in an array 
  const theFigures = [2,4,5,6,7,8,9,12,23,45,68,31,90];
  const afterMath = (num) => {
    const theArray = [];
    num.forEach((n) => {
      const trippled = n*3;
      theArray.push(trippled);
    });
    return theArray;
  }
  console.log(afterMath(theFigures));