<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>변수 선언</title>
</head>
<body>
<h3>변수 선언, 전역/지역/블록 변수</h3>
<hr>
<script>
let x;
function f() {
let y;
x = 10;
y = 20;
z = 30;
if(y == 20) {
let b = 40;
b++;
document.write("if 블록 내 블록변수 b = " + b + "<br>");
}
document.write("함수 f() 내 지역변수 y = " + y + "<br>");
}
f();
document.write("전역변수 x = " + x + "<br>");
document.write("전역변수 z = " + z);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="ko"?
<head>
<meta charset="utf-8">
<title>리터럴</title>
</head>
<body>
<h3>리터럴</h3>
<hr>
<script>
let oct = 015;
let hex = 0x15;
let condition = true;
document.write("8진수 015는 십진수로 " + oct + "<br>");
document.write("16진수 015는 십진수로 " + hex + "<br>");
document.write("condition은 " + condition + "<br>");
document.write('문자열 : 단일인용부호로도 표현' + "<br>");
document.write("그녀는 \"누구세요\"라고 말했습니다.");
</script>
</body>