title: Java to JavaScript conversion
body: <p>I've done many attempts to understand OOP in JavaScript without success. </p>
  
  <p>All articles I've read so far are very confuse and not explain succintly OOP in JS</p>
  
  <p>As a last attempt to understand OOP in JavaScript, can someone translate to JS the following code, pleas?</p>
  
  <pre><code>public class Base
  {
      public String firstName;  // public scope to simplify
      public String lastName;   // the same as above
  
      Base(String firstName, String lastName)
      {
          this.firstName=firstName;
          this.lastName=lastName;
      }
  }
  
  
  public class Derived extends Base
  {
      public int age;  // public scope to simplify
  
      Derived(String firstName, String lastName, int age)
      {
          super(firstName, lastName);
          this.age=age;
      }
  }
  </code></pre>
  
  <p>Inside main()</p>
  
  <pre><code>    Derived person = new Derived("John", "Doe", 25);
  
      System.out.println("My name is " + person.firstName + " " + person.lastName + " and I have " + person.age + " years old.");
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>My name is John Doe and I have 25 years old.
  </code></pre>
  
  <p>Can you please convert this to JavaScript?</p>
  
  <p>Another question: Can we have polimorphism in JavaScript?</p>