@JavaScriptBuzz

9 Followers
2 Following
220 Posts
Your daily hit of JavaScript hacks, fixes, and mind popping tricks

How to Use Defaults in Destructuring

const { a = 0 } = obj. Fallback when missing.

#javascript #destructure #default #howto

https://www.youtube.com/watch?v=ECk25iE0l8k

How to Use Defaults in Destructuring #javascript

YouTube

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...

https://www.youtube.com/watch?v=Ae80oeaiJ7k

Whats wrong with this JavaScript AbortController not aborting? #javascriptreliability

YouTube

How to Use Array.fill for Quick Init

fill(value). Mutates. Or Array(n).fill(0).

#javascript #fill #array #howto

https://www.youtube.com/watch?v=IjkJ3H37jCU

How to Use Array.fill for Quick Init #javascript

YouTube

How to Use Logical OR for Defaults

a || b when falsy. Fast. But 0 and '' become b.

#javascript #logicalor #defaults #howto

https://www.youtube.com/watch?v=4JocukAzK4w

How to Use Logical OR for Defaults #javascript

YouTube

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

https://www.youtube.com/watch?v=1fs8zval7Hk

You Can Use Same Variable Name TWICE?! #codingchallenge

YouTube

How to Use Proxy to Trap Property Access

Proxy intercepts get/set. Validation. Logging. Magic.

#javascript #proxy #trap #howto

https://www.youtube.com/watch?v=Ih7sfWhFl3w

How to Use Proxy to Trap Property Access #howto

YouTube

How to Make Array Lookups 1000x Faster

Set has O(1) lookup. Array has O(n). One change. Instant.

#javascript #set #performance #lookup #howto

https://www.youtube.com/watch?v=eVKgh1Rz2e8

How to Make Array Lookups 1000x Faster #howto

YouTube

How to Prevent setTimeout Drift in Loops

setTimeout inside loops is not precise.

#javascript #settimeout #timers #bug #howto #timing

https://www.youtube.com/watch?v=k__sDjKo21Q

How to Prevent setTimeout Drift in Loops #howto

YouTube

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...

https://www.youtube.com/watch?v=L7zOu_uaOD4

Why does this JavaScript sort put 10 before 2? #javascriptengineering

YouTube

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...

https://www.youtube.com/watch?v=0UH6ovX9Wig

Whats wrong with this JavaScript parseInt losing digits? #javascriptreliability

YouTube