codewithsarir

codewithsarir

Share

Hi, Our page is related to web development with a focus on HTML, CSS, JavaScript, and ReactJS

25/07/2026

Loop Scoping Riddle! 🔄⚡

​Did this nested var loop trip you up? 🪤
​Because var isn't block-scoped, the inner loop overwrites the outer loop's iterator, and all three stored functions point to the same shared variable in memory! By the time you call tasks[0](), tasks[1](), and tasks[2](), the loops are already over.
​Did you guess (B) right away, or did the nested loop trick you? Drop your answer below! 💬👇
​Hashtags:

20/07/2026

Array Sort Trap! 🔢🤔

​If you thought the answer was (A), you just fell for one of JavaScript's oldest traps! 🪤
​By default, JS converts numbers into strings before sorting them. That's why "10" and "20" sneak in front of "5". To fix this and get a proper numerical sort, always pass a comparison function: numbers.sort((a, b) => a - b).
​Drop your initial guess in the comments—did it catch you off guard? 💬👇
​Hashtags:

18/07/2026

JavaScript Interview Check: The Default Array Sort Trap! 🧠💻

Time for a quick code review check! Look closely at the code snippet inside 1000207636.png and tell me the exact output sequence that will print out.
​This specific quirk is a favorite screening question for junior-to-mid level engineering positions because it immediately exposes who understands built-in prototype specifications versus who just guesses based on intuition.
​👉 Analyze the choices inside 1000207636.png:
​(A) [2, 5, 10, 20]
​(B) [10, 2, 20, 5]
​(C) [10, 2, 5, 20]
​(D) An Error
​No cheating by pasting this snippet into your browser console! Rely entirely on your mental compiler.
​Cast your vote in the comments and share your technical reasoning with the group below! 👇✨
​Hashtags:

13/07/2026

Loop Scoping Riddle! 🧠⚡
​Don't let the var keyword trick you. Because var is function-scoped (and not block-scoped), every function pushed into the array points to the exact same variable. By the time you call them, the loop is already over!
​Want to fix it? Just swap var for let to give each iteration its own private scope.
​Which answer did you pick first? Be honest! 🧐👇
​Hashtags:

07/07/2026

Time for another JavaScript brain teaser! 📦✨
​Take a look at the code snippet This "Object Copying Mystery" perfectly highlights how tricky reference handling can get. A lot of devs assume the spread operator completely isolates the new object from the original—but JavaScript handles nested data structures a bit differently!
​Can you solve the mystery? Put your answer in the comments! 👇
A) Sarah, 2
B) Adam, 2
C) Sarah, 1
D) Adam, 1
​Tag a fellow developer who loves tracking down subtle bugs! ☕

29/06/2026

JavaScript quiz time! 🧠 Can you dodge the "Object Reference Trap" shown in sni?
​This is a classic gotcha that trips up both beginners and intermediate coders alike. Understanding how memory allocation and shallow copies work under the hood will save you hours of debugging later on.
​Take a look at the code and drop your vote below! 👇
A) 'Sarah' and 2
B) 'Adam' and 2
C) 'Sarah' and 1
D) 'Adam' and 1
​Tag a developer friend who loves a good code puzzle! ☕✨

25/06/2026
19/06/2026

JavaScript Interview Check: The Array Parameter Mutation Trap! 🧠💻

Time for a quick code review check! Look closely at the code snippet inside snippet and tell me the exact output sequence that will print in the console logs.
​This classic problem frequently catches developers off guard when an original array layout changes unexpectedly somewhere else in a application data loop because an argument shared an underlying reference pointer.
​👉 Analyze the choices inside snippet
​(A) 99, 20
​(B) 99, 99
​(C) 20, 20
​(D) An Error
​No cheating by pasting this snippet into a browser terminal! Rely entirely on your understanding of object mutations in JS.
​Cast your vote in the comments and share your technical reasoning with the group below! 👇✨
​Hashtags:

17/06/2026

JavaScript Interview Check: The Hoisting Shadowing Trap! 🧠💻

Time for a quick code review check! Take a close look at the snippet inside 1000202468.png and tell me the exact output sequence that will print in the console logs.
​This specific combination is a classic favorite for technical evaluation screenings because it forces you to step away from guessing and explicitly trace the memory state of a variable.
​👉 Analyze the choices inside snippet:
​(A) 5, 10, 5
​(B) undefined, 10, 10
​(C) undefined, 10, 5
​(D) An Error
​No pasting this into a browser console! Rely purely on your understanding of the JS compilation steps.
​Cast your vote in the comments and share your logic with the group below! 👇✨
​Hashtags:

14/06/2026

JavaScript Trick Question: The Ref vs. Copy Spread Operator Trap! 🧠💻

Time for a quick code review check! Look closely at the code snippet inside image and tell me exactly what the final console logs will print out.
​This exact scenario causes massive confusion in frontend applications when original data structures unexpectedly change somewhere else in your code cycle because a pointer was shared.
​👉 Study the snippet inside image:
​(A) Sarah, 2
​(B) Adam, 2
​(C) Sarah, 1
​(D) An Error
​Don't paste this into your browser terminal! Try to trace the reference pointers entirely in your head first.
​Cast your vote in the comments and back up your choice with your reasoning below! 👇✨
​Hashtags:

Want your school to be the top-listed School/college in Gilgit?

Click here to claim your Sponsored Listing.

Location

Telephone

Address

Rehman Colony Naveed Shaheed Road Sonikot Gilgit
Gilgit
1500