See the Pen JS 산술 by nilgi (@nilgi) on CodePen.
<p id="op"></p>
<script>
let x = 12;
let y = 24;
let z = x + y; // + 더하기
document.getElementById("op").innerHTML = z;
</script>
<p id="op1"></p>
<script>
let x1 = 12;
let y1 = 24;
let z1 = x1 - y1; // - 빼기
document.getElementById("op1").innerHTML = z1;
</script>
<p id="op2"></p>
<script>
let x2 = 12;
let y2 = 24;
let z2 = x2 * y2; // * 곱하기
document.getElementById("op2").innerHTML = z2;
</script>
<p id="op3"></p>
<script>
let x3 = 12;
let y3 = 24;
let z3 = x3 / y3; // / 니누기
document.getElementById("op3").innerHTML = z3;
</script>
<p id="op4"></p>
<script>
let x4 = 5;
let y4 = 2;
let z4 = x4 % y4; // % 나눈 몫의 나머지
document.getElementById("op4").innerHTML = z4;
</script>
<hr>
<p id="op5"></p>
<script>
let x5 = 5;
x5++; // ++ 증가
document.getElementById("op5").innerHTML = x5;
</script>
<p id="op6"></p>
<script>
let x6 = 5;
x6--; // -- 감소
document.getElementById("op6").innerHTML = x6;
</script>
<p id="op7"></p>
<script>
let x7 = 6;
let z7 = x7 ** 3; // ** 지수
document.getElementById("op7").innerHTML = z7;
</script>
<hr>
<p id="op8"></p>
<script>
let x8 = 6;
let z8 = Math.pow(x7,3); // 지수 쓰는 다른 방법 Math.pow(n,n)
document.getElementById("op8").innerHTML = z8;
</script>
• 수학처럼 곱하기, 나누기, ()를 먼저 계산하다.