loading...
re: I don't really use classes with Javascript. You can encapsulate private data with closures though. const Unicorn = name => { let level = 0 ...
 

Earlier in Jonas Schmedtmann’s JS course he explained that IIFEs and closures could let you pick what you would like to expose to the public. I also read a post by Eric Elliot discussing classes vs function constructors vs factory functions, in which he advocated for the use of factory functions over the other two options for future flexibility. Just wondering if this is how most devs approach this “problem”.

 

When I need to work in javascript, and want to work "properly", I prefer to use typescript for this need, as it allows me to, at least, have compile-time checks for such code smell and possible errors.

Do you use TypeScript by itself or use it mainly for a framework? I recently picked up a course on Udemy from Stephen Grider that teaches using TypeScript with Angular.

Both through frameworks (Angular as well, actually) and by itself (my blog's SSG, which I made, as an example).

code of conduct - report abuse