Anderson, all right?
Apparently in your Javascript code there is a small error:
var date = new Date();
var hora = data.getHours();
In the above script, you declared a variable that has not been declared, which is the case of the date, the compiler is trying to recognize some variable but it is not possible, you need that date to become the variable you declared earlier.
var hora = date.getHours();
In this case, you will be able to use the getHours method because the variable date
is the type Date
.
To conclude, you have assembled a string that will be shown inside an HTML element that has the id #msg
, programming languages usually recognize a string (phrase) using double or single quotes string = "sua frase aqui";
or string = 'sua frase ${aqui} com alguma variável;
I believe that with these tips, you can follow your online learning.
Yeah, but where’s the problem ?
– JeanExtreme002
The page was to appear the time and does not appear already tested the call of js with an Alert and working, the codes perish this with the correct syntax but does not appear the time
– Anderson Miranda
Could be that:
Document
this with theD
in capital letters should bedocument
,msg.innerHTMl
theL
this in minuscule should bemsg.innerHTML
– Icaro Martins
I switched here but nothing has changed, I’m taking a course on youtube my code is the same as the teacher’s but you’re not going... I’d have another way to put the hours beyond that??
– Anderson Miranda