How to get the day of the week from the day number in JavaScript?

A much more elegant way which allows you to also show the weekday by locale if you choose to is available starting the latest version of ECMA scripts and is running in all latest browsers and node.js:

console.log(new Date().toLocaleString('en-us', {  weekday: 'long' }));

Leave a Comment