Coders Mantra
205 subscribers
22 photos
34 videos
26 files
64 links
Coders Study is Now Coders Mantra.
Get coding quizzes, help, resources, and motivation.
HTML, CSS, JavaScript, React, React Native, Expo, tailwind, WordPress, PHP, UX UI Design.
Download Telegram
Glad!! 🔥🧨 This helped you, and you all like and support me.
Forwarded from PM
Media is too big
VIEW IN TELEGRAM
Margin Collapse
🔥31
Google Chrome ne haal hi mein DevTools mein ek AI Assistance feature pesh kiya hai 🔥

Aap iska upyog kar sakte hain:

- DOM elements ko customise karne ke liye

- UI bugs ko theek karne ke liye

- Aapke liye CSS likhne ke liye

- Aur bahut kuch...

Yeh web developers ke liye game-changing hai aur productivity ko bahut zyada badhaega.
Media is too big
VIEW IN TELEGRAM
🔥 That's a fantastic tool for CSS developers.

it's a 🧨 goldmine of hundreds of stunning, pure CSS patterns and backgrounds. And the best part? They're all completely free.

Use these patterns to:
- Make hero sections pop.
- Design sleek dashboards.
- Elevate your portfolio.

This tool truly makes your work stand out from the crowd.

Visit 👉 PatternCraft
Answer will be posted on
👉 @CodersMantra
Answer:

1-
"10" - "4" + "2" → "62"

(10 - 4 = 6, then + "2" → string concat → "62")

2-
"10" - "4" - "2" → 4

(10 - 4 = 6, then 6 - 2 = 4)
Answer will be posted on
👉 @CodersMantra
Sorting Surprise - Answer
Answer will be posted on
👉 @CodersMantra
Answer & Explanation:
// 1
console.log(null + 1);

👉 null + 1 → 1

null becomes 0 in numeric context.
null represents "no value" but converts to 0 in numeric operations.

// 2
console.log(undefined + 1);

👉 undefined + 1 → NaN

undefined is not a number → NaN.
undefined represents "not defined" and converts to NaN in numeric operations
Answer will be posted on
👉 @CodersMantra
======The Hoisting Illusion - Explained======

Case 1: Function Declaration
greet();
function greet() {
console.log("Hello!");
}

Output: "Hello!"

Explanation:
- Function declarations are fully hoisted to the top of their scope
- Both the function name AND its body are hoisted
- The JavaScript engine effectively reorganizes the code
like this:👇

function greet() {
console.log("Hello!");
}
greet(); // Now it's called after declaration
Case 2: Function Expression (with const/let)
greet();
const greet = () => console.log("Hi");

Error: Cannot access 'greet' before initialization

Explanation:
- Variable declaration is hoisted, but NOT the assignment
- const and let variables enter the Temporal Dead Zone (TDZ) until initialization
- The engine sees it like:👇

const greet; // TDZ starts here - cannot access greet
greet(); // Error: Trying to access in TDZ
greet = () => console.log("Hi"); // Initialization happens here
🔸Function Expression:🔸
Function Expression ka matlab hai jab hum ek function ko kisi variable ke saath assign karte hain.
Jaise:
const greet = () => console.log("Hi");

Isme greet ek variable hai jo ek function ko hold kar raha hai. Function Expressions ko hoist nahi kiya jata, iska matlab hai ki aap inhe declare karne se pehle call nahi kar sakte.

Agar aap aisa karte hain, toh error aayega kyunki variable hoist hota hai, lekin uska value assign nahi hota jab tak code us line tak nahi pahuchta.

🔸Hoisting:🔸
Hoisting ka matlab hai ki JavaScript mein functions aur variables ko unke scope ke top par le jaya jata hai.

Function declarations poori tarah se hoist hoti hain, matlab unka naam aur body dono upar le jaye jate hain.

Isliye aap function ko uske declare hone se pehle bhi call kar sakte ho. Lekin agar aap function expression use karte ho, jaise const ya let ke saath, toh sirf variable declaration hoist hoti hai, assignment nahi.

Is wajah se aapko "Cannot access before initialization" error milta hai.
🔥1
Answer will be posted on
👉 @CodersMantra