A함수 내부에 B함수를 호출할 수 있다.
굳이 이렇게 포함시키는 이유는, 수정할 때 A, B 둘다 수정하지 않고 한 번에 A만 수정하면 되도록 하기 위함이다.
function cutFruitPieces(fruit){
return fruit * 4;
}
function fruitProcessor(apples, oranges){
const applePieces = cutFruitPieces(apples);
const orangePieces = cutFruitPieces(oranges);
const juice = `Juice with ${applePieces} piece of apple and ${orangePieces} pieces of orange.`;
return juice;
}
www.udemy.com/course/the-complete-javascript-course/
Learn Modern Javascript (Build and Test Apps) - Full Course
The modern JavaScript course for everyone! Master JavaScript with projects, challenges and theory. Many courses in one!
www.udemy.com
'자바스크립트' 카테고리의 다른 글
[JavaScript] 40. Basic Array Operations(Methods) (0) | 2020.12.04 |
---|---|
[JavaScript] udemy - the complete javascript course를 들으며 기록합니다. (0) | 2020.12.04 |
[JavaScript] 37. Reviewing Functions (Declarations, Expressions, Arrows) (0) | 2020.12.04 |
[JavaScript] 35. Arrow Functions 화살표 함수 (0) | 2020.12.04 |
[JavaScript] 34. Function declarations(선언) VS. Expressions(표현) (0) | 2020.12.04 |