Skip to content

Commit ff17e9a

Browse files
committed
Add Basic.html and Variable.html with initial JavaScript examples and structure
1 parent 7776273 commit ff17e9a

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
8+
<script>
9+
// Print "Hello World" to the console
10+
console.log("Hello World");
11+
// print "Hello World" to the document
12+
document.write("Hello World");
13+
// Print "Hello World" to the alert
14+
alert("Hello World");
15+
</script>
16+
17+
</head>
18+
<body>
19+
20+
</body>
21+
</html>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<script>
8+
9+
// variable declaration
10+
var x = 5;
11+
console.log(x); // prints 5
12+
13+
// variable declaration with let
14+
let y = 10;
15+
console.log(y); // prints 10
16+
17+
Number1 = 20;
18+
console.log(Number1); // prints 20
19+
20+
// variable declaration with const
21+
const z = 30;
22+
console.log(z); // prints 30
23+
24+
// z = 90; // Error: Assignment to constant variable
25+
26+
27+
// Example of variable
28+
Name = "Joy";
29+
age = 20;
30+
height = 5.8;
31+
console.log(Name); // prints Joy
32+
console.log(age); // prints 20
33+
console.log(height); // prints 5.8
34+
35+
36+
37+
</script>
38+
</head>
39+
<body>
40+
41+
</body>
42+
</html>

0 commit comments

Comments
 (0)