Avoid this 'empty' javascript/typescript object mistake! 🧠🧠🧠 #shorts #javascript #typescript #coding

preview_player
Показать описание
"const x = {}" doesn't create an empty object. We dive into it in the video, explaining why and how to fix it!

Oh, did you know that `const x = {}` has a prototype? 😲 That's right! Even though it looks empty, it actually inherits from the `Object` prototype. This means that if you were to add properties or methods to `x`, they would be available on any object created from it. Now, this might not seem like a big deal, but trust us, it could come in handy someday! 😉

Рекомендации по теме