title: Get the first and last item in an Array - JS
body: <p>I am trying to get the first and last item in array and display them in an object.</p>
  
  <p>What i did is that I use the first and last function and then assign the first item as the key and the last item as the value.</p>
  
  <pre><code>var myArray = ['Rodel', 'Mike', 'Ronnie', 'Betus'];
  
  function firstAndLast(array) {
  
  var firstItem = myArray.first;
  var lastItem = myArray.last;
  
   var objOutput = {
     firstItem : lastItem 
    };
  
  }
  
  var display = transformFirstAndLast(myArray);
  
  console.log(display);
  </code></pre>
  
  <p>however this one gets me into trouble. It says undefined. Any idea why is that?</p>