Background
I am a developer with a background history of approximately 9 years in both Java and C#.
In those languages, Classes and taxonomic classification and inherent to the object paradigm.
And so, when ECMA6 came out, I was very happy to see classes in the language... and I started using them everywhere.
Problem
Turns out that using classes in JavaScript is a trap.
If you use them, you will go to your grave never knowing how miserable you are.
And you will never really understand JavaScript. You will think you do, but you don't.
Questions
So clearly, after watching this full conference, I realized I don't know JavaScript.
All my life I have been formatted with the OOP with classes paradigm, and now I don't even know where to look for help, or even to get started.
- In JavaScript style, how would you go about representing the Animal kingdom, with inheritance? I would use a class Animal, and then a Class Dog, and instantiate objects of dogs, for example. This is not the JavaScript way.
An example of non-JavaScvript:
class Animal{
constructor(aName){
this.name = aName;
}
}
class Dog extends Animal{
constructor(){
super(aName);
this.type = "Furry dog";
}
}
let myDog = new Dog("Boby");
- What is the JavaScript way of doing this?
At this point, I am looking for guidance. After trying I was unable to find anything helpful, mainly because I believe I am so lost that I am not even searching for the right thing.
Thanks in advance.