@JavaScriptBuzz

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

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

What's wrong with this JavaScript unhandled rejection?

What's wrong with this JavaScript unhandled rejection crashing Node. The JavaScript code returns a promise without catch. In JavaScript unhandled rejections can terminate the process.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascri...

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

Whats wrong with this JavaScript unhandled rejection? #javascriptreliability

YouTube

What's wrong with this JavaScript this in callback?

What's wrong with this JavaScript this in a callback losing context. The JavaScript code passes a method as callback and this becomes undefined. In JavaScript event handlers the method loses its instance.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptrel...

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

Whats wrong with this JavaScript this in callback? #javascriptclass

YouTube

What's wrong with this JavaScript async loop?

What's wrong with this JavaScript async loop in a task runner. The JavaScript code uses forEach with async callbacks, so errors and awaits are ignored. In JavaScript services this drops failures and hides retries.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascript...

https://www.youtube.com/watch?v=6NGGecXhFY4

Whats wrong with this JavaScript async loop? #javascriptconcurrency

YouTube

Why does this JavaScript optional chaining hide the bug?

Why does this JavaScript optional chaining hide the bug in a form. The JavaScript code uses optional chaining when the value could be zero. In JavaScript 0 is valid but optional chaining skips it.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliab...

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

Why does this JavaScript optional chaining hide the bug? #javascriptzero

YouTube

Why does this JavaScript negative zero exist?

Why does this JavaScript negative zero exist and break sign check. The JavaScript code checks if a value is negative with less than zero. In JavaScript -0 fails the check and passes as positive.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javasc...

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

Why does this JavaScript negative zero exist? #javascript0

YouTube

How to Create Partial Functions With bind

bind pre-fills args. Partial application. No wrapper.

#javascript #bind #partial #howto

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

How to Create Partial Functions With bind #howto

YouTube

What's wrong with this JavaScript typeof null?

What's wrong with this JavaScript typeof null returning object. The JavaScript code checks typeof before accessing properties. In JavaScript validation this lets null through and crashes on property access.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliab...

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

Whats wrong with this JavaScript typeof null? #javascriptbackend

YouTube

Why does this JavaScript map drop entries?

Why does this JavaScript map drop entries in production. The JavaScript code uses JSON stringify as a map key, so object key ordering changes and collisions overwrite data. In JavaScript services this corrupts caches.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascrip...

https://www.youtube.com/watch?v=Ff9tr-MYD5k

Why does this JavaScript map drop entries? #javascriptmapkey

YouTube