ES6 – declare a prototype method on a class with an import statement
You can still attach a method on a class‘ prototype; after-all, classes are just syntactic sugar over a “functional object”, which is the old way of using a function to construct objects. Since you want to use ES6, I’ll use an ES6 import. Minimal effort, using the prototype: import getColor from ‘path/to/module’; class Car { … Read more