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 138 views
1 answer 126 views
1 answer 180 views
1 answer 160 views
1 answer 126 views
1 answer 128 views
3 answers 167 views
167 views asked May 26, 2022 by avibootz
...