Link Search Menu Expand Document

Use the Spread Operator to Evaluate Arrays In-Place

Summary

  • ES5 uses apply() to compute the maximum value in an array using Math.math()
  • apply() is important as Math.max() expects comma-separated arguments.

Final Code

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;

arr2 = [...arr1];  // Change this line

console.log(arr2);