[JavaScript 기본] 함수 정리
·
React/JavaScript 기본
함수는 반복 로직을 재사용하고, 코드를 역할 단위로 묶는 기본 단위임예시로 흐름을 먼저 보겠음// 함수 선언문 (Function Declaration)function greeting() { console.log("안녕하세요");}console.log("호출 전");greeting(); // 함수 호출console.log("호출 후");function getArea(width, height) { // 중첩 함수 (Nested Function) function another() { console.log("another"); } another(); // ( ) 안에 있는 것을 "매개변수(parameter)"라고 부름 const area = width * height; return area;..