-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut48-JsVariables.html
52 lines (45 loc) · 1.48 KB
/
tut48-JsVariables.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript Variables And Operators</title>
</head>
<body>
<div class="con">
<h1>JavaScript variables and Operators</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos, earum, consequatur architecto totam ea nihil ex ducimus sint deleniti quod inventore nobis perferendis?</p>
</div>
<script>
// Variables :
var a=10; //integer
var b='x'; //string
var c="Sasi"; //string
var d=3;
console.log(a); //printing
console.log(b);
console.log(c);
// Operators in JavaScript
// 1) Unary Operators
a=-a;
console.log(a);
// 2) Binary Operators
d=10+5;
console.log(d);
// Arithmetic Operations :
var num1=5;
var num2=2;
console.log("num1 + num2 : "+(num1+num2));
console.log("num1 - num2 : "+(num1-num2));
console.log("num1 * num2 : "+(num1*num2));
console.log("num1 / num2 : "+(num1/num2));
console.log("num1++: "+(num1++));
console.log("++num1: "+(++num1));
console.log("num1--: "+(num1--));
console.log("--num1: "+(--num1));
// Exponent = **
console.log("num1 ** num2 : "+(num1**num2)); // 2^5
</script>
</body>
</html>