0
What is wrong with this code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible"Content="IE=edge> <meta name ="viewport" content="width=device-width, initiate> <title>Digital Clock </title) (/head> (body> I <div id="clock"></div> <script> setInterval(()=>{ let date =new Date () let clock =document.getElementById('clock') clock.innerHTML= date.getHours()+":"+ date.getMinutes()+":"+ date.getSeconds()+":"+ },1000); </script> </body> </html>
2 Answers
+ 5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible"Content="IE=edge>
<meta name ="viewport" content="width=device-width, initiate>
<title>Digital Clock </title>
</head>
<body>
<div id="clock"></div>
<script>
setInterval(()=>{
let date =new Date ();
let clock =document.getElementById('clock');
clock.innerHTML=
date.getHours()+":"+
date.getMinutes()+":"+
date.getSeconds()+":"+
},1000);
</script>
</body>
</html>
I think the typo mistake, and in the script tag your mistake in javascript code, now attempt yourself to javascript code.
+ 5
Tanmoy Chakrabortty Use code playground to execute and it will be helpful to attach with your question.