Does Es6 classes make function contructors obsolete? π€ would you say "use a class instead" when you see me using a function constructor?
Have you seen anyone use the bitwise operators? π€ People hardly ever use those guys.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (7)
I'd say use ES6 classes. Sure the process of creating a class is slightly bigger than calling a function, but if you do it only sometimes, then there will be no difference for the performance, and you get much cleaner code.
Avoid creating new objects from classes inside loops though, calling a function is better in this case:
For all the other cases you are fine.
ππThanks
Function constructors still have their place for now, but they are dying. They are going to be used for a very long time for compatibility reasons, although you may not see them too often in day to day work.
I have only ever seen bitwise operators in hobby projects. That isnt to say that there isnt a use for them, but you are unlikely to ever need them.
Only the process of creating new classes is costly.
So in case of react functional vs class based wont give you much difference, if you scripted your components properly.
yeah i have never used them, lol, i most times forget they exist.π then i go over basics and i see them like "oh these guys"
In my opinion: yes, given how "objects" work in ES6. In most cases both a class and function constructor will serve the same goal, the class syntax is just a bit closer to what you can find in other languages. Just my two cents though, there might be some differences I don't know of.
Bitwise operators are indeed not that common but that's mostly because they are only useful in certain specific cases.
yeap, class is more like a straightforward simpler way.
NSFW: Use cases for Bitwise operators in Js
DarkΓΈ Tasevski γ» 0 min read