prestudy -Week1

Sunghee Kim·2022년 4월 21일
0
post-thumbnail

Function

04-1 함수의 정의와 호출

A JavaScript function is a block of code designed to perform a particular task.
Input을 받아서 특정한 기능을 수행하고 output을 내는 일을 하는 것이 함수.

함수의 기본적인 기능(구성요소)- 늘 있어야만 하는 것은 아님.
1)input을 받기
2)기능수행
3)output을 반환

function myFunction(p1, p2) {
return p1 * p2; // The function returns the product of p1 and p2
}

04-2 return이 있는 함수

return 은 변수에 할당이 가능.
console.log 는 변수에 할당이 불가능.

04-3 input이 있는 함수

A parameter is a named variable passed into a function.
함수를 선언할때 input.
Parameter variables are used to import arguments into functions.
함수를 호출할때 받는 input.

profile
개발하는 스트롱맘

0개의 댓글