title: how to call attributes of more than one class in js
body: <p>I am studying oojs and I have here the summary of the classes, to demonstrate the problem. Because the classes are large with many attributes and validations. I need the <code>book</code> class to receive the attributes of the<code> Author</code> class (name) and the <code>Category</code> class (category), but in my test I get undefined for my imports in the<code> Book</code> class. What could I have done wrong? I appreciate the help!</p>
  <p>class author</p>
  <pre><code>export default class Author {
      constructor(name){
          this.name = name;
      }
  
      set name (name){
          if(name === '')
              throw new Error (`this field cannot be empty`)
              this._name = name;
      }
      
      get name (){
          return this._name;
      }
  }
  </code></pre>
  <p>class category</p>
  <pre><code>export default class Category {
      constructor(category){
          this.category = category;
      }
  
      set category (category){
          if(category === '')
              throw new Error (`this field cannot be empty`)
              this._category = category;
      }
      
      get category (){
          return this._category;
      }
  }
  </code></pre>
  <p>class book</p>
  <pre><code>import Author from './Author.js'
  import Category from './Category.js'
  
  export default class Book{
      constructor(name, title, category){ 
          this.name = name;
          this.title = title;
          this.category = category;
      }
      set name(name){
          if(name instanceof Author)
             this._name = name;     
      }
      set category(category){
          if(category instanceof Category)
             this._category = category;     
      }
    
      set title (title){
         if(title === ' ')
              throw new Error (`this field cannot be empty`) 
          this._title = title;
      }
      get name(){
          return this._name;
      }
      get category(){
          return this._category;
      }
      get title(){
          return this._title;
      }
  }
  
  </code></pre>
  <p>test</p>
  <pre><code>import Book from './Book.js';
  
  try{
      const newBook = new Book(' Anne', 'Design UX/UI', 'Design');
      console.log(`saved ${newBook.name} ${newBook.title} ${newBook.category}`)
  }catch(err){
      console.log(`err ${err}`)
  }
  
  //saved undefined Design UX/UI undefined
  
  </code></pre>