Does it mutate 😱
Array.prototype.toLocaleString
No mutation
Description
The toLocaleString()
method of Array
instances returns a string representing
the elements of the array. The elements are converted to strings using their
toLocaleString
methods and these strings are separated by a locale-specific
string (such as a comma ",").
Example
const array1 = [1, 'a', new Date('21 Dec 1997 14:12:00 UTC')];
const localeString = array1.toLocaleString('en', { timeZone: 'UTC' });
console.log(localeString);
// Expected output: "1,a,12/21/1997, 2:12:00 PM",
// This assumes "en" locale and UTC timezone - your results may vary