<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test009.html</title>
<script type="text/javascript">
num1 = 7;
num2 = 3;
document.write("원 래 의 num1 : ");
document.write(num1);
++num1;
document.write("<br>첫 번째 ++num1 : ");
document.write(num1);
++num1;
document.write("<br>두 번째 ++num1 : ");
document.write(num1);
document.write("<br>원래의 num2 : ");
document.write(num2);
--num2;
document.write("<br>첫 번째 --num2 : ");
document.write(num2);
--num2;
document.write("<br>두 번째 --num2 : ");
document.write(num2);
/*
원래의 num1 : 7
첫 번째 ++num1 : 8
두 번째 ++num1 : 9
원래의 num2 : 3
첫 번째 --num2 : 2
두 번째 --num2 : 1
*/
</script>
</head>
<body>
</body>
</html>
변수의 증감 관찰해보기
728x90
'WEB Archive' 카테고리의 다른 글
[HTML] Javascript - 변수의 초기화 관찰 (0) | 2024.08.21 |
---|---|
[HTML] Javascript - 변수의 연산 관찰 (0) | 2024.08.21 |
[HTML] Javascript - 복합대입연산자 관찰 += / -= / *= / /= / %= (0) | 2024.08.21 |
[HTML] Javascript - 각종 연산자들 실습 (0) | 2024.08.21 |
[HTML] Javscript - Date() 객체 (0) | 2024.08.21 |
댓글