Object.prototype.function is not a function Javascript
<p>I'm sure this is a common question, but I am completely at a lack for why this is not working.</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function WorleyNoise2D(numPoints, width, height, seed, type) {
    this._numPoints = numPoints || 1;
    this._keyPoints = {};
    this._getKeyPoints();
    
    return this._keyPoints;
}


WorleyNoise2D.prototype._getKeyPoints = function () {
    for (var i = 0; i &lt; this._numPoints; i++) {
        this._keyPoints.push({
            x: Math.random(),
            y: Math.random()
        });
    }
};

(function () {
    console.log(WorleyNoise2D(10));
})();</code></pre>
</div>
</div>
</p>

<p>It keeps returning that the prototype is not a function.</p>

<p><strong>* UPDATE *</strong> figured it out after I started thinking about what you guys were saying!</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function WorleyNoise2D(numPoints, width, height, seed, type) {
  this._numPoints = numPoints || 1;
  this._keyPoints = {};
}


WorleyNoise2D.prototype._getKeyPoints = function() {
  for (var i = 0; i &lt; this._numPoints; i++) {
    this._keyPoints[i] = {
      x: Math.random(),
      y: Math.random()
    };
  }
};



(function() {



  var worly = new WorleyNoise2D();
  worly._numPoints = 10;

  worly._getKeyPoints();

  console.log(JSON.stringify(worly._keyPoints));


})();</code></pre>
</div>
</div>
</p>