Struggling to compare number of sides to determine shape type
<p>Looking to determine shape type by sides (number) passed in .. code below only goes to first index, triangle .. my guess is because I'm not properly comparing sides number to sides property in array? I tried using <code>filter</code>, <code>forEach</code>, and <code>map</code> and ran into rabbit hole. Thanks in advance for the help. </p>

<pre><code>var Shape = function(sides) {
  this.sides = sides;

  if (this.sides &lt; 3 || typeof(this.sides) !== 'number'){
    this.sides = null;
  }
};
Shape.prototype.getType = function(sides){
  var shapes = [{type: "triangle", sides: 3}, {type: "quadrilateral", sides: 4}, {type: "pentagon", sides: 5}, {type: "hexagon", sides:6}, {type: "heptagon", sides: 7}, {type: "octagon", sides: 8}, {type: "nonagon", sides: 9}, {type: "decagon", sides: 10}];

  for (var i = 0; i &lt; shapes.length; i++){
    console.log(shapes[i].sides);
    var sideExists = shapes.indexOf(shapes[i].sides) &gt; -1;
    if (sides === sideExists){
      return shapes[i].type;
    }else{
      return 'Could not determine type';
    }
  }
};
</code></pre>