Page 136 - Computer Software Application TP - Volume 1
P. 136
COMPUTER SOFTWARE APPLICATION - CITS
console.log(“Updated value of y:”, y); // Output: 8
// Constants
const PI = 3.14;
// PI = 3.14159; // Trying to reassign a constant will result in an error
console.log(“Value of PI:”, PI); // Output: 3.14
</script>
</body>
</html>
3 Save the program as a .html file
4 Open the html file with a web browser
5 Go to the browsers console tab and verify the output.
II Using different types of variable
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> Different types variable </title>
</head>
<body>
<script>
// Numbers:
let num = 123.45;
// Strings:
let text = “This is a string.”;
// Boolean (true/false):
let isTrue = true;
// Arrays (lists of values):
121
CITS : IT & ITES - Computer Software Application - Exercise 38