title: Problem to do an arrays exercise. Beginner inside
body: <p>I'm learning Javascript, and I have a problem with arrays in <code>Javascript</code>, and I have to do a <code>class</code> called <strong>TV Show</strong> with title, thematicand and actors (actors with array) Then, I have to do a function to grab a specific actor and classify it as &quot;favorite&quot; randomly.</p>
  <p>Once done, I get an &quot;empty&quot; array.</p>
  <p>This is my code.</p>
  <pre><code>class TVShow {
      constructor (title, thematic, principalActors){
          var arrayActors = new Array();
          this.title=title;
          this.thematic=thematic;
          principalActors=[];
      
          this.generateFavActor = function(){
              var long = principalActors.lenght;
              let calc = Math.floor(Math.random()*(long));
              arrayActors = principalActors[calc];
          }
          console.log(arrayActors);
      }
  }
  var show01= new TVShow(&quot;The Revolution&quot;, &quot;Accion&quot;,[&quot;Hello&quot;,&quot;Hello2&quot;]);
  show01.generateFavActor();
  
  var show02 = new TVShow(&quot;Peaky Blinders&quot;, &quot;Drama&quot;,[&quot;Hello&quot;,&quot;Hello2&quot;, &quot;Hello3&quot;] );
  show02.generateFavActor();
  
  var show03 = new TVShow (&quot;Stranger Things&quot;, &quot;Accion&quot;, [&quot;Hello&quot;,&quot;Hello2&quot;, &quot;Hello3&quot;, &quot;Hello4&quot;]); 
  show03.generateFavActor();
  </code></pre>
  <p>Thanks!!</p>