-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83055e1
commit 5b168f5
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Immediately Invoked Function Expressions (IIFE) | ||
|
||
|
||
(function chai(){ | ||
// named IIFE | ||
console.log(`DB CONNECTED`); | ||
})(); | ||
|
||
( (name) => { | ||
console.log(`DB CONNECTED TWO ${name}`); | ||
} )('hitesh') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// if | ||
const isUserloggedIn = true | ||
const temperature = 41 | ||
|
||
// if ( temperature === 40 ){ | ||
// console.log("less than 50"); | ||
// } else { | ||
// console.log("temperature is greater than 50"); | ||
// } | ||
|
||
// console.log("Execute"); | ||
// <, >, <=, >=, ==, !=, ===, !== | ||
|
||
// const score = 200 | ||
|
||
// if (score > 100) { | ||
// let power = "fly" | ||
// console.log(`User power: ${power}`); | ||
// } | ||
|
||
// console.log(`User power: ${power}`); | ||
|
||
|
||
// const balance = 1000 | ||
|
||
// if (balance > 500) console.log("test"),console.log("test2"); | ||
|
||
// if (balance < 500) { | ||
// console.log("less than 500"); | ||
// } else if (balance < 750) { | ||
// console.log("less than 750"); | ||
|
||
// } else if (balance < 900) { | ||
// console.log("less than 750"); | ||
|
||
// } else { | ||
// console.log("less than 1200"); | ||
|
||
// } | ||
|
||
const userLoggedIn = true | ||
const debitCard = true | ||
const loggedInFromGoogle = false | ||
const loggedInFromEmail = true | ||
|
||
if (userLoggedIn && debitCard && 2==3) { | ||
console.log("Allow to buy course"); | ||
} | ||
|
||
if (loggedInFromGoogle || loggedInFromEmail) { | ||
console.log("User logged in"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// switch (key) { | ||
// case value: | ||
|
||
// break; | ||
|
||
// default: | ||
// break; | ||
// } | ||
|
||
const month = "march" | ||
|
||
switch (month) { | ||
case "jan": | ||
console.log("January"); | ||
break; | ||
case "feb": | ||
console.log("feb"); | ||
break; | ||
case "march": | ||
console.log("march"); | ||
break; | ||
case "april": | ||
console.log("april"); | ||
break; | ||
|
||
default: | ||
console.log("default case match"); | ||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const userEmail = [] | ||
|
||
if (userEmail) { | ||
console.log("Got user email"); | ||
} else { | ||
console.log("Don't have user email"); | ||
} | ||
|
||
// falsy values | ||
|
||
// false, 0, -0, BigInt 0n, "", null, undefined, NaN | ||
|
||
//truthy values | ||
// "0", 'false', " ", [], {}, function(){} | ||
|
||
// if (userEmail.length === 0) { | ||
// console.log("Array is empty"); | ||
// } | ||
|
||
const emptyObj = {} | ||
|
||
if (Object.keys(emptyObj).length === 0) { | ||
console.log("Object is empty"); | ||
} | ||
|
||
// Nullish Coalescing Operator (??): null undefined | ||
|
||
let val1; | ||
// val1 = 5 ?? 10 | ||
// val1 = null ?? 10 | ||
// val1 = undefined ?? 15 | ||
val1 = null ?? 10 ?? 20 | ||
|
||
|
||
|
||
console.log(val1); | ||
|
||
// Terniary Operator | ||
|
||
// condition ? true : false | ||
|
||
const iceTeaPrice = 100 | ||
iceTeaPrice <= 80 ? console.log("less than 80") : console.log("more than 80") |