📜  Javascript 第一类函数 - Javascript 代码示例

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

代码示例1
function runFiveMiles() {
  console.log('Go for a five-mile run');
}

function liftWeights() {
  console.log('Pump iron');
}

function swimFortyLaps() {
  console.log('Swim 40 laps');
}
function exerciseRoutine(postRunActivity) {
  runFiveMiles();
  postRunActivity();
}
exerciseRoutine(() => console.log('Stretch! Work that core!'));
function Monday() {
  exerciseRoutine(liftWeights);
}

function Tuesday() {
  runFiveMiles();
  swimFortyLaps();
}

function Wednesday() {
  runFiveMiles();
  runFiveMiles();
}

function Thursday() {
  runFiveMiles();
  liftWeights();
}

function Friday() {
  runFiveMiles();
  swimFortyLaps();
}