JAVASCRIPT
자바스크립트 연습 코드 나이로 성년여부 판단 javascript asking age to determine whether adult or minor
devorldist
2022. 5. 3. 21:59
728x90
반응형
SMALL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var age = prompt("How old are you?", "0");
if(age >= 20) {
document.write("You are an adult.");
} else {
document.write("you are a minor.");//document는 문서객체, write()출력 메서드.
}
</script>
</body>
</html>
<!--html 주석-->
출처 : doit 자바스크립트
728x90
반응형
LIST