Funciones de primera clase de JavaScript
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();
}
Ashamed Albatross