Skip to content
Advertisement

why is my js script not displaying timer result?

I’m making a countdown timer hours minutes and second but the script I’m running doesn’t display the results I wrote in the js script, can anyone correct my code so that the timer can work? The problem

JavaScript

Advertisement

Answer

Issues that I found in code.

  • Your countdown variable must be defined as let countdown = new Date().getHours(). There is a syntax error there.
  • Inside your setInterval function your now variable, if it is planning to get the current hour time it should be defined as var now = new Date().getHours();
  • Also you have to redefine the Number function because Number is a datatype in javascript

Pseudo Code.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement