toLocaleString js code example
Example 1: reverse string js
const solution = (str) => str.split("").reverse().join("");
Example 2: m06 javascript tolocalestring returning for june
const d = new Date('2010-08-05')
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d)
const mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d)
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d)
console.log(`${da}-${mo}-${ye}`)
Example 3: reverse string js
str.split('').reduce((reversed, character) =>{
return character + reversed;
}, '');
Example 4: toLocalString
Data.prototype.toLocaleString()