JS Dasar: 11. operator augmented assigment
by istiq20
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Operator augmented assigment</title>
</head>
<body>
<script>
let result = 1 + 2; // 3
document.writeln("<p>1 + 2 = " + result + "</p>");
let originalResult = result; // 3
result -= 1; // 2
document.writeln("<p>" + originalResult + " - 1 = " + result + "</p>");
originalResult = result; // 2
result *= 2; // 4
document.writeln("<p>" + originalResult + " * 2 = " + result + "</p>");
</script>
</body>
</html>