Get last item in map JS

Get the last element in a map in JavaScript

add a third parameter to the map loop parameters to get the length and get the last item following this example:

row.map((item, i, {length}) => (

  //last element
  if(i + 1 === length){
    // code for last item
  }

));