nodesagar Profile Banner
Sagar Prasad Profile
Sagar Prasad

@nodesagar

Followers
8
Following
4
Media
3
Statuses
150

Not Just another tech guy + procrastination :)... Delhi ๐Ÿ“ Dehradun

Delhi, India
Joined May 2023
Don't wanna be here? Send us removal request.
@nodesagar
Sagar Prasad
1 month
So yeahโ€ฆ Itโ€™s been ages. But here I am, finally trying to start this. If not now, then. probably next yearโ€”or never. Honestly, Iโ€™ve just been vibing, scrolling, binge-watching โ€œhow to learn X in 10 minutesโ€ videos, and pretending that counts as progress.
1
0
0
@nodesagar
Sagar Prasad
16 days
๐Ÿšจ JIMS_GN College site redirects to an inappropriate page when opened via Google search. Just Look at the initiator chain in dev tools. Although Direct access is fine. Please fix it! .@JIMS_GN @jimsgn.@JIMSRohini .@jimsljptweets .@ugc_india.@AICTE_INDIA.@IndianCERT .@GoI_MeitY
Tweet media one
Tweet media two
0
0
1
@nodesagar
Sagar Prasad
26 days
Itโ€™s Day 12 of learning JavaScript, and Iโ€™ve realized Iโ€™m kind of stuck in tutorial hell.
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿ’ก Nullish Coalescing Operator ??. Returns the right-hand value only if the left is null or undefined. let name = null ?? "Guest"; // โ†’ "Guest". ๐Ÿ”€ Ternary Operator. Shorthand if. else ๐Ÿ’ก. let age = 18;.let access = (age >= 18) ? "Allowed" : "Denied";.
1
0
0
@nodesagar
Sagar Prasad
27 days
โœ… Check If the Array Is Empty. if (userEmail.length === 0) {. console.log("Array is empty");.}. โœ… Check If Object Is Empty. if (Object.keys(emptyObj).length === 0) {. console.log("Object is empty");.}.
1
0
0
@nodesagar
Sagar Prasad
27 days
โš ๏ธ Falsy Values. In JS, these are considered false in boolean contexts:. false. 0. "" (empty string). null. undefined. NaN. Everything else is truthy.
1
0
0
@nodesagar
Sagar Prasad
27 days
โš–๏ธ Comparison Operators. == vs === โ†’ loose vs strict equality. != vs !== โ†’ loose vs strict inequality. >, <, >=, <=. ๐Ÿ” Logical Operators. && (AND). || (OR). ! (NOT).
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿ”น switch. Useful when comparing a single value to many cases. const day = Monday;.switch(day) {. case 'Monday':. console.log("Start of week");. break;. default:. console.log("Another day");.}.
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿง  Day 11: JavaScript Control Flow & Logical Operators. ๐Ÿ” Control Flow in JS. ๐Ÿ”น if. if (true) {. // runs this block.}. ๐Ÿ”น if. else. if (condition) {. // if true.} else {. // if false.}. ๐Ÿ”น else if. if (a > b) {. }.else if (a === b) {. }.else {. }.
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿงฑ Behind the scenes:. GEC is created. one() context pushed โ†’ runs console.log. Calls two(), its context pushed. two() runs โ†’ pops off โ†’ back to one() โ†’ pops off โ†’ done โœ….
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿ” Example. function one() {. console.log("One");. two();.}. function two() {. console.log("Two");.}. one();. // Output: One โ†’ Two.
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿ”น Call Stack (๐Ÿ“ž๐Ÿ“š). JavaScript is single-threaded, so it uses a Call Stack to manage execution:. Global context gets pushed first. Each function call creates a new execution context that gets pushed on top. Once a function completes, it gets popped off the stack.
1
0
0
@nodesagar
Sagar Prasad
27 days
๐Ÿ”น What happens during execution?. Whenever JS runs:. A new Execution Context is created. It consists of two components:. Variable Environment (includes variables, functions, and arguments). Thread of Execution (the single line in which code is executed).
1
0
0
@nodesagar
Sagar Prasad
27 days
Three types:. ๐ŸŒ Global Execution Context (GEC): Created when the JS file starts running. Only one exists. ๐Ÿ” Function Execution Context: Created whenever a function is invoked. ๐Ÿงช Eval Execution Context: Rarely used, created when eval() is called.
1
0
0
@nodesagar
Sagar Prasad
27 days
Okay, I didn't post yesterday, but I'm still consistent, and here is what I learned yesterday:. Day 10: How JavaScript Works Behind the Scenes ๐Ÿ› ๏ธ. ๐Ÿ”น Execution Context: This is the environment where JS code runs.
1
0
0
@nodesagar
Sagar Prasad
29 days
โœ… Arrow Function IIFE:. (() => {. console.log("Arrow IIFE running!");.})();. โš ๏ธ Notes:.IIFE creates a private scope. Variables inside the IIFE can't be accessed from outside.
1
0
0
@nodesagar
Sagar Prasad
29 days
๐Ÿ”ธ Why Use IIFE?. Avoid polluting the global scope. Encapsulationโ€”useful when you want to run some code privately. Common in module patterns. โœ… Example with Parameters:. (function (name) {. console.log(`Hello, ${name}!`);.})("Sagar");. // โžœ Hello, Sagar!.
1
0
0
@nodesagar
Sagar Prasad
29 days
(function () {. console.log("IIFE is running!");.})();. ๐Ÿง  The function is:. Wrapped in () to make it an expression. Immediately followed by () to invoke it.
1
0
0