@JavaScriptBuzz

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

Why does this JavaScript trim not removing all whitespace?

Why does this JavaScript trim not removing all whitespace. The JavaScript code uses trim on user input. In JavaScript trim only handles space tab newline not unicode spaces.

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

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

Why does this JavaScript trim not removing all whitespace? #javascriptwhitespace

YouTube

How to Stop instanceof From Lying Across Frames

Objects from iframes fail instanceof checks.

#javascript #instanceof #arrays #bug #howto #frames

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

How to Stop instanceof From Lying Across Frames #howto

YouTube

How to Use Queue With shift and push

FIFO. shift for dequeue. push for enqueue.

#javascript #queue #shift #howto

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

How to Use Queue With shift and push #shift

YouTube

How to Stop JSON Stringify From Dropping BigInt

JSON.stringify throws on BigInt and breaks APIs.

#javascript #bigint #json #api #howto #bug

https://www.youtube.com/watch?v=lIdJY-9OxWc

How to Stop JSON Stringify From Dropping BigInt #javascript

YouTube

What's wrong with this JavaScript BigInt mixing with Number?

What's wrong with this JavaScript BigInt mixing with Number in a calculator. The JavaScript code adds BigInt and Number. In JavaScript this throws and crashes the app.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliability #javascriptapi #jav...

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

Whats wrong with this JavaScript BigInt mixing with Number? #javascriptnumber

YouTube

What's wrong with this JavaScript Object.assign overwriting?

What's wrong with this JavaScript Object.assign overwriting nested objects. The JavaScript code uses Object.assign for config merge. In JavaScript nested objects are copied by reference and get overwritten.

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

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

Whats wrong with this JavaScript Object.assign overwriting? #javascriptcodereview

YouTube

Why does this JavaScript NaN break every comparison?

Why does this JavaScript NaN break every comparison in a validator. The JavaScript code uses === to check for NaN but NaN is not equal to itself. In JavaScript forms invalid numbers pass silently.

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

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

Why does this JavaScript NaN break every comparison? #javascriptengineering

YouTube

How to Get Unique Values in One Line

Set removes duplicates. Spread back to array. No loop.

#javascript #set #unique #dedupe #howto

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

How to Get Unique Values in One Line #set

YouTube

flatMap Can Filter AND Transform?!

flatMap is a SECRET WEAPON! Return empty array to REMOVE items, return array with value to KEEP. One pass does filter AND map together! This trick will make your code 10x cleaner!

#javascript #javascripttricks #flatmap #arrayfilter #arraytransformation #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascripttips #functionalprogramming #advancedjavascript

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

flatMap Can Filter AND Transform?! #JavaScript

YouTube

How to Use Symbol for Unique Keys

Symbols never collide. Private-ish. Perfect for metadata.

#javascript #symbol #unique #howto

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

How to Use Symbol for Unique Keys #howto

YouTube