markdown guide
 

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:

// Bad example
for (i=0; i < 1000; i++) {
  const c = new Something()
}
// Better example
for (i=0; i < 1000; i++) {
  const c = doSomething()
}

For all the other cases you are fine.

 
 
  1. 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.

    • Side note: I would also discourage the use of classes, they are inefficient and many frameworks are starting the transition to move away from them (See React)
  2. 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"

 
  1. 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.

  2. Bitwise operators are indeed not that common but that's mostly because they are only useful in certain specific cases.

 
Classic DEV Post from May 6

The state of GraphQL

The report about the state of GraphQL base on the partial data gathered during the annual "The State of JavaScript" survey

naijadeveloper profile image
i am a front-end developer :), **whispering**(i sometimes peek into the back-end world. TELL NO ONE🀫). Here to read, learn and write.