title: Passing key/value objects as a parameter in a Javascript constructor
body: <p>I'm setting up an object constructor and would like to pass an key/value object as a parameter. I was wondering what would be the correct way to do so? Right now I'm just passing the keys as the parameters:</p>
  
  <pre><code>(function() {
      function Venue(name, poor, satisfactory, excellent) {
          this.name = name;
          this.serviceRatings = {
              poor: poor,
              satisfactory: satisfactory,
              excellent: excellent
          };
      }
  
    var dining = new Venue("dining", .1, .15, .2);
  
    console.log(dining["serviceRatings"]["satisfactory"] // .15
  }());
  </code></pre>
  
  <p>Although this works, coming from a Ruby background it only felt right to pass the object itself and assign the it's values in the initializer. This was the best equivalent I could think of: </p>
  
  <pre><code>class Venue
    def initialize(name, serviceRatings = {})
      @name = name
      @poor = serviceRatings[:poor]
      @satisfactory = serviceRatings[:satisfactory]
      @excellent = serviceRatings[:excellent]
    end
  end
  </code></pre>
  
  <p>Is there a way to do this in Javascript? The way I have things written now makes me feel as if I'm bloating my constructer's list of parameters (unless this <strong>is</strong> the right way to do this).</p>