-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators.js
More file actions
66 lines (48 loc) · 1.25 KB
/
operators.js
File metadata and controls
66 lines (48 loc) · 1.25 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
// operators
// Arthetic operators
// add +
// sub -
// mul *
// div /
// modlusu %
// exponent ** (like 2 power 3 = 2x2x2 = 6)
// increment ++
// decrement --
let a = 10;
let b = 5;
console.log(a+b);
console.log(a-b);
console.log(a*b);
console.log(a/b);
console.log(a%b);
console.log(a**b);
// comparizon operator
var le = 10;
var ss = 10;
console.log(le<ss)
console.log(le<ss)
console.log(le<ss)
console.log(le<ss)
// strict operators == (Loose quality / double equal) define true or false
// === ( strict equality / triple equal)
let str = "10";
let num = 10;
console.log(str==num);
console.log(str===num);
// Ternary operators (true or flase )
var name=(condition)? "true value" : "false value"
let age = 18;
let result = (age>=18)? "he is eligible to vote" : "hi is not eligible to vote"
console.log(result)
// Write a program that checks if a given number is even or odd using a ternary operator.
var odd = 7;
var result = (odd % 2==0)? "Check the Number is odd" : "the number is even"
console.log(result);
// task
let agee = 18;
let resultt = (agee>=18 && agee<=100)? "he is eligible to vote" : "hi is not eligible to vote"
console.log(resultt)
// OR perator
let mark = 99;
let rank = (mark <=35 || mark >=100)? "pass": "fail"
console.log(rank);