-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.js
21 lines (19 loc) · 856 Bytes
/
test1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// write a js program to check two numbers and return true
// if one of the number is 100 or if the sum of the
// two numbers is 100
// ==============================first method < basic >====================================
var a = 50, b = 50;
if(a === 100 || b === 100 || a + b === 100)
{
console.log(true);
}
else console.log(false);
// ==============================second method < using trinity operator>===================================
var a = 50, b = 50;
var isNumberTo100 = a == 100 || b == 100 || a + b == 100 ? true : false;
console.log(isNumberTo100);
// ==================================third method < arrow function >===========================================
var isEqualTo100 = (a,b) => a === 100 || b === 100 || a + b === 100
console.log(isEqualTo100(50,50));
console.log(isEqualTo100(0,100));
console.log(isEqualTo100(1,10));