How to Use Defaults in Destructuring
const { a = 0 } = obj. Fallback when missing.

How to Use Defaults in Destructuring
const { a = 0 } = obj. Fallback when missing.

What's wrong with this JavaScript AbortController not aborting?
What's wrong with this JavaScript AbortController not aborting fetch. The JavaScript code creates AbortController but never calls abort. In JavaScript cleanup never runs and requests pile up.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreli...

How to Use Array.fill for Quick Init
fill(value). Mutates. Or Array(n).fill(0).

How to Use Logical OR for Defaults
a || b when falsy. Fast. But 0 and '' become b.

You Can Use Same Variable Name TWICE?!
🔥 NO WAY! Destructuring allows DUPLICATE variable names in the same statement! const {a, a} = obj is VALID JavaScript! Last one silently wins. ESLint doesn't catch this by default. Tag a dev who needs to see this!
#javascript #javascripttricks #codingchallenge #destructuring #javascriptes6 #javascriptquiz #javascriptweird #javascriptwtf #javascriptbugs #codinginterview #codingtips #javascriptshorts

How to Use Proxy to Trap Property Access
Proxy intercepts get/set. Validation. Logging. Magic.

How to Make Array Lookups 1000x Faster
Set has O(1) lookup. Array has O(n). One change. Instant.

How to Prevent setTimeout Drift in Loops
setTimeout inside loops is not precise.

Why does this JavaScript sort put 10 before 2?
Why does this JavaScript sort put 10 before 2 in a leaderboard. The JavaScript code uses sort without a comparator, so numbers are sorted as strings. In JavaScript apps this breaks every numeric ranking.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliabili...

What's wrong with this JavaScript parseInt losing digits?
What's wrong with this JavaScript parseInt losing digits on user input. The JavaScript code parses a string without radix, so leading zeros trigger octal in older engines. In JavaScript APIs this corrupts IDs.
#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #ja...
