JavaScript's Object Destructuring is Bad?

preview_player
Показать описание
Don't believe everything that you hear. The ... destructuring operator in JavaScript isn't inherintely bad. It's just powerful, and powerful things can get abused if you use it wrong.

#shorts
Рекомендации по теме
Комментарии
Автор

Please make sure primeagen didn't see this one

msrini
Автор

That's not destructuring, that's spreading. It's called the spread operator :)

romzamir
Автор

This is the spread operator though, not object destructuring. Destructuring does not create new objects.

wlockuz
Автор

This is also in part due to the fact that some people learn frameworks as their starting point (react, vue, angular) instead of the JS language, which I do understand is a fair starting point, but people still need to learn beyond the basics.
In any language you code, there are ways to shoot yourself in the foot.

kr
Автор

i see this a lot when people use reduce, the beautiful thing about reduce is that it comes with its own atomic state that you can mutate to your hearts content and mutation will always be more efficient than creating new memory

aritark
Автор

I've seen tons of tutorials, courses, so far you are the best at explaining things, and most of your topics are really practical.
I want to purchase a course from you, maybe next next month because right now I'm unemployed, broke, and applying jobs.

coffeefps
Автор

It very much depends but I think that part of the issue is the performance of Typescript in destructuring. The story gets pretty complicated when allocating and reallocating memory and can lead to performance problems. I think most devs are just calling out it’s wide spread use deserves more carefully considering the ramifications.

zekebinion
Автор

You mean the spread operator?

Because you said object destructing!!

amjadyahia
Автор

What I find to get used to is that … just makes a shallow copy. It happened to me more than once that I thought I copied everything within this object just to find out that I missed the function or object within the object. This can get nasty at times when dealing with not-well defined objects

simonkraemer
Автор

I hate to be THAT guy, ackchuwawy 🤓. The first example is not destructuring, it’s spreading, and not a destructure operator, but a spread operator (technically it’s not even an operator, but rather a spreding syntax)

yapet
Автор

plz,can i konw the vscode theme used by you in this vedio 😢 thanks!

betterkeiii
Автор

Hey Jack
Could you please start the React Router Dom series 😅
In latest version it's kind a overwhelming
Memory Router, Hash, Static, etc
Loader, lazy, error element and there much much more..

LifeIsCrazyAsShit
Автор

i love your videos man, , but what is the " ... 8: 99, 89: " ???
i didn't understand this line .. can you please till me i adore javascript

ahmadali-yfmb
Автор

This feature is amazing, though I see some potential pitfalls for newcomers. Particularly when it comes to mutation of properties like objects/arrays (which are copied by reference/pointer instead of by value), as any mutations will be applied to the original object that was used with the spread operator.

mickmister
Автор

Object creation is not bad, JavasScript is bad. 💀

shawn-skull
Автор

depends on what you do and how often you use it. when something is easy it doesnt mean the most efficient in all the cases.

gordonfreimann
Автор

I agree that this is not always bad. Even in the crab language you can copy and clone things. You as the developer have the ability to do bad things. This is true no matter what language you use.

Thanks for the friendly reminder. :)

lifeofdandotme
Автор

I wonder if that means that the last solution does not abide "functional programming" since the argument is being mutated. In my personal opinion Functional Programming princples still work since the call back is not exposed to other consumer, so this mutation is not problematic.

ShaharHarshuv
Автор

It's just mean, it will make your Javascript more Blazing Slow 🐌

patrickmiharisoa
Автор

Though I don't have experience with JS...

This, very much, feels like the old saying about "If all you have is a hammer, everything looks like a nail..."

Folks use a powerful tool when they are first programming, when the programs are small enough, that anything 'extra' won't have a major, if at all noticeable, impact...

However, when one becomes reliant to bad coding techniques, one loses sight to a cleaner code usage.

chamelius