WON.dev
chapter09 : 재귀함수 본문
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
//"Hello" 문자열을 입력 받은 횟수 만큼 출력하는 재귀함수 작성
function sayHello(n) {
if (n != 0) {
document.write("Hello");
sayHello(n - 1);
}
}
```
sayHello(5);
```
</script>
</head>
<body>
</body>
</html>
'WEB.JS > 04.함수_JS' 카테고리의 다른 글
chapter11 : 함수문제 (0) | 2023.05.19 |
---|---|
chapter10 : 타이머_내장함수 (0) | 2023.05.19 |
chapter08 : 콜백함수 (0) | 2023.05.19 |
chapter07 : 스코프 (0) | 2023.05.19 |
chapter06 : 함수사용예제 (0) | 2023.05.19 |