How to display the current day in JavaScript

1 Answer

0 votes
const today = new Date();
const day = today.getDay();
const days = ["Sunday","Monday","Tuesday","Wednesday ","Thursday","Friday","Saturday"];

console.log("Today is: " + days[day]);




/*
run:

"Today is: Monday"

*/

 



answered Nov 7, 2022 by avibootz

Related questions

...