title: Using hasOwnProperty() on an array
body: <p>Can I use hasOwnProperty() on an array? I have this array of <a href="https://en.wikipedia.org/wiki/RGBA_color_model" rel="nofollow noreferrer">RGBA</a> values:</p>
  <pre><code>colors = [[240,120,120,255], [125,222,111,255], [9,56,237,255], [240,120,120,255], [240,120,120,255], [240,120,120,255]]
  </code></pre>
  <p>I'd like to create an object that sorts them in order of their frequency in the array. I'm trying a combination of things.</p>
  <p>First I thought to convert the array into an object using:</p>
  <pre><code>function toObject(arr) {
    var rv = {};
    for (var i = 0; i &lt; arr.length; ++i){
      rv[i] = arr[i];
    }
    //console.log('the array is now this ', rv)
    return rv;
  }
  </code></pre>
  <p>But that returns something like this:</p>
  <pre><code> {0: [240,120,120,255], 1:[125,222,111,255],2:[9,56,237,255], 3:[240,120,120,255], 4:[240,120,120,255], 5:[240,120,120,255]}
  </code></pre>
  <p>So I'm wondering if I can call hasOwnProperty on it like this?</p>
  <pre><code>  function reduceColors(passedArray){
      var empty = {}
      return passedArray.filter(function(item){
        return empty.hasOwnProperty(item[&quot;value&quot;])
      })
    }
  </code></pre>