title: Cannot read property 'sort' of undefined
body: <p>I was trying to reference an object (which is inside of an array) and there is an error:</p>
  <blockquote>
  <p>Cannot read property 'sort' of undefined</p>
  </blockquote>
  <p>This is my code:</p>
  <pre><code>const items = [
      { id: 1, value:5, weight: 14 },
      { id: 2, value:8, weight: 3  },
      { id: 3, value: 10, weight: 8},
      { id: 4, value: 2, weight: 4},
  ];
  
  maxWeight = 15;
  
  function sort(){
      let sort = 0;
      items.value.sort((a, b) =&gt; b - a);
      for(let i = 0; i &lt; items.length; i++){
          console.log(items[i].value)
          sort += items[i].value;
          if(sort &lt;= maxWeight){
              break;
          }
      }
      console.log(sort);
  }
  
  sort();
  </code></pre>
  <p>What did I do wrong? Did I reference an object incorrectly?</p>