Re:First look: adding type annotations to JavaScript
by cphoover on Thursday March 10, 2022 @01:43PM
(#30630724)
Certainly cleaner than using the old prototypal inheritance syntax.
// Dog Class
function Dog(_name){
// call the parent constructor
Animal.apply(this,arguments);
}
// extends the Animal prototype chain
Dog.prototype = new Animal();
Although the new class syntax may obfuscate from what's actually happening in an effort to look more like traditional class-based languages like Java.
However I'm the type of person that will only use React function components in my codebase. I don't think the object-oriented style has added much too my programming, except the temptation to reach for an unnecessary abstraction.
However I'm the type of person that will only use React function components in my codebase. I don't think the object-oriented style has added much too my programming, except the temptation to reach for an unnecessary abstraction.