Preview:
  const transactions = [200, 450, -400, 3000, -650, -130, 70, 1300];
  function myFunc(item, date = '2nd Feb') {
    // adding in date default here but assume its from somewhere else
    
    return { amount: item, date }; // creating an object with both item and date
  }

  // forEach
  const test1 = transactions.map(item => myFunc(item, date));
  console.log(test1);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter