title: Is there a best practice in terms of when and what type of information to pass into a constructor function
body: <p>I'm making a chess app in javaScript and am in the process of creating constructor functions for each of the pieces. A fellow dev and I got into a discussion about what is the most appropriate way to assign the information that will be related to that object. My opinion was that passing in the image and color string makes the code more concise and we can instantiate the object with all the information it needs.</p>
  
  <pre><code>var Pawn = function(color, image) {
    this.color=color;
    this.image=image;
  }
  </code></pre>
  
  <p>then when i instatiate a pawn i can simply create that object in one fell swoop:</p>
  
  <p>my_pawn = new Pawn('white', '');</p>
  
  <p>my friend is arguing that it is better to do something along the lines of this:</p>
  
  <pre><code>var Pawn = function() {
  }
  </code></pre>
  
  <p>and then when we instantiate an instance it would then be given those values:</p>
  
  <pre><code>var my_pawn = new Pawn()
  my_pawn.color = 'white'
  my_pawn.image = '&lt;img&gt;'
  </code></pre>
  
  <p>His argument stems from the fact that Pawn then becomes dependent on these image string, and that if we want to later extract that to its own object then we'll have to change each line of code where we instantiated the pawn object. </p>
  
  <p>Is there a consensus to when parameters should be inserted into a constructor function and when it should be defined upon creation of the instance of the object?
  Thanks for your help(:</p>