A class body can only contain methods, but not data properties
So when you are inside an ES6 class, the buildReferences()
syntax works like the arrow function syntax.
If you want to actual do what you are trying to do, you would have to do it inside of another function, like the constructor:
class Pano {
constructor() {
// you can create a data property here and assign it a function
this.buildReferences = ()=> {
console.log("hello");
}
this.buildReferences();
}
// this is the syntax for a function in an ES6 class
regularFunction(){
}
}
let test = new Pano();
FYI: TypeScript supports data properties so what you are doing would work in Typescript.