Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Don't understand this error in javascript within my html file: ',' expected.javascript

I apologize for the silly request, but I am brand new to HTML and JavaScript and am trying to self-teach. My code right now is based off a resource I found that teaches you how to make a timer. My only question is, why does line 16 (var seconds...) come up with the error in the title, specifically with the red line under "var"? Thank you in advance. Code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

<p id="demo"></p>

<script>
var x = setInterval(function() {
    var timer = 600;
    var minutes = Math.floor(timer // 60);
    var seconds = Math.floor(timer % 60);
    document.getElementById("demo").innerHTML = minutes + "minutes and " + seconds + "seconds";
    if (timer < 0) {
    clearInterval(x);
    document.getElementById("demo").innerHTML = "EXPIRED"
}
    }, 1000);
</script>
    </h2>
    <a href="html/contact.html">Contact Information</a>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You will probably find this is to do with line 15, being commented out at character 37, I think instead of putting / you've ended up putting // which comments out in js

from my testing, removing the secondary / fixes the issue with the code you pasted

what you had:

    var timer = 600;
    var minutes = Math.floor(timer // 60);
    var seconds = Math.floor(timer % 60);

what works for me

    var timer = 600;
    var minutes = Math.floor(timer / 60);
    var seconds = Math.floor(timer % 60);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!