WEB.JS/04.함수_JS
chapter08 : 콜백함수
GAWON
2023. 5. 19. 09:35
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
[//1.선언적](https://1.xn--6i4b27ff4b/) 함수 정의
function callback() {
document.write("callback 함수 호출");
}
[//2.다른](https://2.xn--2j1bu8j/) 선언적 함수 정의
function callTenTimes(func) { //매개변수 : func는 함수 저장할 변수
for(var n = 0; n < 10; n++){
func(); //callback();
}
}
[//3.다른](https://3.xn--2j1bu8j/) 선언적 함수 호출
callTenTimes(callback);//첫 번째 선언적 함수를 전달 (괄호없이 이름만 전달)
</script>
</head>
<body>
</body>
</html>