class Place { constructor(object) { this.role = 5; // как обратится к setRole(r) ?? } setRole(role) { this.role = role; } build { // как обратится к setRole(r) ?? } } 
  • one
    What is the problem? - Grundy
  • four
    Now I say nonsense, but maybe ... through this ? - user207618

1 answer 1

Yes, just through this.
Plus you have forgotten the brackets for the method declaration.

 build(){ var role = Math.random(); this.setRole(role); }