title: Get the last Item which is an object from an array of objects
body: <p>I am trying to get the last object from an array of the objects using following way,</p>
  
  <pre><code>const rowLen = previous_data.High.length;
            var temp = previous_data.High.map((object,i) =&gt; {
               if (rowLen === i + 1) {
                  return object;
              }
          });
  </code></pre>
  
  <p>and then I want to fill the values in the next object so, I am doing like </p>
  
  <p>temp[0].keyname .</p>
  
  <p>Now while getting temp it is returning me the array of object so after 2nd I get </p>
  
  <pre><code>[ 0: undefined, 1: {key:value}]
  </code></pre>
  
  <p>So, I am not understanding why is it returning the array and also the previous one I want only last object .</p>