I do not understand why I can call a method of a class in the constructor even if the code for that method is after the call. Shouldn’t I declare it first and then call it?
class ClassName {
constructor() {
this.functionName();
}
functionName() {
console.log("Do something.");
}
}
new ClassName();