-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass5.js
More file actions
37 lines (30 loc) · 813 Bytes
/
class5.js
File metadata and controls
37 lines (30 loc) · 813 Bytes
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
// if .. else and function in js
// practice code 1
// function testNum(num1 , num2){
// let result;
// if(num1 == num2){
// result ="YES";
// }else{
// result ="NO";
// }
// return result;
// }
// console.log(testNum(5,2));// output: NO
// practice code2
// function checkValue(a, b) {
// if (a === 1)
// if (b === 2)
// console.log("a is 1 and b is 2");
// else
// console.log("a is not 1");
// }
// console.log(checkValue(1,3)); bad practice
// good practice for nested if
// function Value( a, b ) {
// if (a === 1 && b === 2) {
// console.log("a is 1 and b is 2");
// } else {
// console.log("a is not 1");
// }
// }
// console.log(Value(1,3));