Skip to content

Commit cfeb94f

Browse files
committed
Add Operator.html and Operator_js.js with arithmetic, comparison, and logical operators examples; Add Variables.html demonstrating variable declarations and usage
1 parent 9ababad commit cfeb94f

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 src="Operator_js.js"></script>
8+
</head>
9+
<body>
10+
11+
</body>
12+
</html>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Arithmetic Operators:
2+
// + (Addition)
3+
// - (Subtraction)
4+
// * (Multiplication)
5+
// / (Division)
6+
// % (Modulus, returns the remainder)
7+
// ++ (Increment by 1)
8+
// -- (Decrement by 1)
9+
x = 345
10+
y = 67
11+
12+
console.log(x+y);
13+
console.log(x-y);
14+
console.log(x*y);
15+
console.log(x/y);
16+
console.log(x%y);
17+
console.log(++x);
18+
console.log(--y);
19+
20+
// Comparison Operators:
21+
22+
// == (Equal to)
23+
// != (Not equal to)
24+
// === (Strict equal to)
25+
// !== (Strict not equal to)
26+
// > (Greater than)
27+
// < (Less than)
28+
// >= (Greater than or equal to)
29+
// <= (Less than or equal to)
30+
x = 34
31+
y = 67
32+
console.log(x==y)
33+
console.log(x!=y)
34+
console.log(x>y)
35+
console.log(x<y)
36+
console.log(x<=34)
37+
console.log(x>=34)
38+
39+
console.log(34 !== '34')
40+
41+
// Logical Operators:
42+
43+
// && (Logical AND)
44+
console.log((x<y) && (x==304));
45+
// || (Logical OR)
46+
console.log((x<y) || (x==340));
47+
// ! (Logical NOT)
48+
console.log(!(x<y));

Lectures/Day02/Variables.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
</head>
8+
<body>
9+
<script>
10+
11+
document.write("welcome","<br>");
12+
13+
let data = 34;
14+
document.write(data,"<br>")
15+
16+
var number = 900;
17+
document.write(number,"<br>");
18+
19+
number = 90
20+
document.write(number,"<br>");
21+
22+
const num = 890;
23+
document.write(num,"<br>")
24+
25+
num = 89; // to constant variable.
26+
document.write(num,"<br>")
27+
28+
</script>
29+
</body>
30+
</html>

0 commit comments

Comments
 (0)