title: How to use class functions in another class?
body: <p>How can i use class instance in another class like a pointer in C++ to class instance functions?</p>
  
  <p>Example: </p>
  
  <pre><code>class A {
      constructor()
      { 
         this.block = [];
      }
  
      method()
      {
         return this.blocks.length;
      }
  }
  </code></pre>
  
  <p>another class: </p>
  
  <pre><code>class B {
      constructor(instance)
      { 
         this.instance = instance;
      }
  
      method()
      {
          this.instance.method(); // here i'm getting cannot get length of undefined
      }
  }
  </code></pre>
  
  <p>If i'm trying to to like that i'm getting problems to call it</p>