title: Creating a function that accepts an array of numbers
body: <p>I'm trying to write a function that  accepts an array of numbers and makes a new array of only the first and last elements of the given array.</p>
  
  <p>I can't figure out how to get a function to work with my current code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var firstLast = [5, 10 ,15 ,20, 25, 30, 40];
  
  firstLast.splice(1, firstLast.length - 2);
  
  console.log(firstLast);</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to have it so that when I call the function, I can put the array of numbers as the parameter.</p>