We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 6: JavaScript Dates
Day 6: JavaScript Dates
Sort by
recency
|
213 Discussions
|
Please Login in order to post a comment
This was my answer guys:
dayName = new Date(dateString).toLocaleDateString("en-US", { weekday: "long" });
This is my solution , guess what , it is the easiest solution for this problem.
function getDayName(dateString) { let dayName; let days = { Sun: "Sunday", Mon: "Monday", Tue: "Tuesday", Wed: "Wednesday", Thu: "Thursday", Fri: "Friday", Sat: "Saturday"
}
Here is a simple solution without using any map or map object.