How to display the current day in Node.js

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

1 answer 221 views
1 answer 223 views
1 answer 279 views
1 answer 239 views
1 answer 221 views
1 answer 229 views
3 answers 303 views
303 views asked May 26, 2022 by avibootz
...