JavaScript gets the day of the week the current date is

From , 3 Years ago, written in JavaScript, viewed 53 times.
URL https://pastebin.vip/view/2f635a9f
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p id="demo">Click the button to display todays day of the week.</p>
  6.  
  7. <button onclick="myFunction()">Try it</button>
  8.  
  9. <script>
  10. function myFunction()
  11. {
  12. var d = new Date();
  13. var weekday=new Array(7);
  14. weekday[0]="Sunday";
  15. weekday[1]="Monday";
  16. weekday[2]="Tuesday";
  17. weekday[3]="Wednesday";
  18. weekday[4]="Thursday";
  19. weekday[5]="Friday";
  20. weekday[6]="Saturday";
  21.  
  22. var x = document.getElementById("demo");
  23. x.innerHTML=weekday[d.getDay()];
  24. }
  25. </script>
  26.  
  27. </body>
  28. </html>
  29.  
  30. //javascript/7858

Reply to "JavaScript gets the day of the week the current date is"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website