Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

chapter02 : 선언적함수 본문

WEB.JS/04.함수_JS

chapter02 : 선언적함수

GAWON 2023. 5. 19. 09:26
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//선언적 함수를 "변수"에 저장할 수 있다.

```
//1.선언적 함수 정의 + 변수 저장
var view = function yourFunction(){
	document.write("<h3>yourFunction 실행</h3>");
}

//2.변수에 저장된 선언적 함수 호출
view(); //yourFunction();

//정의된 선언적 함수를 나중에 따로 "변수"에 저장할 수 있다.
//1.선언적 함수 정의
function ourFunction(){
	document.write("<h3>yourFunction 실행</h3>");
}
//2.정의된 함수 변수에 저장
var view2 = ourFunction; //ourFunction 뒤에 ()없음
//3.변수에 저장된 선언적 함수 호출
view2();

```

</script>
</head>
<body>

</body>
</html>

'WEB.JS > 04.함수_JS' 카테고리의 다른 글

chapter06 : 함수사용예제  (0) 2023.05.19
chapter05 : 선언적함수_표현적함수  (0) 2023.05.19
chapter04 : 표현적함수  (0) 2023.05.19
chapter03 : 선언적함수  (0) 2023.05.19
chapter01 : 선언적함수  (0) 2023.05.19