Parsing error! I am at the beginning of a course and struggling to evolve, plese have a look

Here is my code, I would like some help please to find out why is it not working.
The course I am takeing is not up to date and probablly as the languages have evolve there are some errors along the way.
I want to find out if this is true and how can I keep up too date .
Thank you!
This is the code bellow :

// If we click on the start /reset button 
// If we are playing 
// Reload page
// If we are not playing
// Set score to 0
// show countdown box    
// reduce the time by 1 second in loops 
// time left?
// YES -> Continue 
// NO <- Game Over! 
// Change button to reset 
// Generate Q & As

// If we click on an answer box 
// If we are playing 
// Correct? 
// Yes 
// Increase score  
// Show Correct box for 1 second 
// Generate new Q & As 
// No
// Show Try Again box for 1 second

function () {
    "use strict";
var playing = false;
var score;
var action;
var timeremaining;

document.getElementById("startreset").onclick = function () {
    if (playing === true) {
    } else {  
        playing = true; 
        score = 0;
        document.getElementById("scorevalue").innerHTML = score;
        timeremaining = 60;
        document.getElementById("timeremainingvalue").innerHTML = timeremaining;

        document.getElementById("startreset").innerHTML = "Reset Game";

function startCountdown() {
    action = setInterval(function () {
        timeremaining -= 1;
        document.getElementById("timeremainingvalue").innerHTML = timeremaining;
        if (timeremaining === 0) {  
        document.getElementById("gameOver").innerHTML = "<p>Game over!</p><p>Your score is " + score + ".</p>";
        playing = false;
        document.getElementById("startreset").innerHTML = "Start Game";
    }, 1000);

function stopCoutdown() {

function hide(id) {
    document.getElementById(id).style.display = "none";

function show(id) {
    document.getElementById(id).style.display = "block";

function generateQA() {

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


You have not explain what error you are receiving or how to reproduce the error. I notice generateQA is an empty function. Why is that?

thank you for your time kind Sir
The code I have showed you is part of the course that i am doing, and this part is actually a math game. in order for you to have a more detailed perspective on what I am working at, I should give you a link, but since I am not aloud to at this stage, I will just write to you the complete code in separate stages/ languages .
I tried to do it now , but it doesn’t allow me to reply because it says there is a link inside the text.
How can I show it to you in a different way?

Thank you again for your time!

I would suggest putting all of your code in Codepen and then share your Codepen profile name along with the pen name and we can find it.

Thank you, I will try that then.

I can’t just copy paste the code somehow, instead of writing it again in Codepen?

I have managed to add the jsbin file link into the description of html in Codepen. Please check it there !

Sorry, forgot to leave you the name Dragos2 !

I am able to view your project. How do I recreate the Parse error you mention in your topic title? What is the exact error you see in the console?

the error was is shown inside brackets, in the js file. at this point of the code, there are supposed to be active several features of the game, instead nothing actully works, none of the features. I am just trying to find out why, and how, and if I need a different course for javascript, as it might be absolite.

When does the error occur?

this are the errors :
25.Missing name in function statement.
25. Stopping .(22% scanned)
ERROR: Parsing error: Unexpected token ( function () {
If I delete the use strict function I have much more errors.
I hope this answers your question

You are seeing those error in the jsbin project? Can you take a screenshot which shows the errors? I am unable to duplicate when viewing the project link above.

you should be able to copy the code from the JSbin and paste it in your software(in my case brachets) and then try and run it so you can understand wich are the features that are unusable .
the code should work as a game, and at this stage it should start a timer when you press start, and the start button to change to reset and when the timer comes down to 0 shoul appear a box that shows you the score and the mesage “GAME OVER” , but unfortunately none of the features work.
I don’t know how to add screenshots or videos here .

you can chech again in Codepen and access the link again as I made some alterations.

It would be a lot simpler if you would just create a new pen with all your code, so I don’t have to keep going to the other pen to get a new link to see the new code which I then have to copy/paste in my own local editor to see the changes.

I know but, that would take a lot of time, as I am a beginner and I don’t write that fast, so if you would be so kind and access it from the jsbin.

Just copy and paste your code from the 3 sections in the jsbin and put them in Codepen.

Anyway, using your latest code, I click the start button and it shows the following when the timer gets to zero.

I see one error showing in the console:

Uncaught TypeError: Cannot read property ‘style’ of null

This error is because you call hide("timeremainig"); but there is no element with id=“timeremainig” anywhere in your HTML. There is however an element with id=“timeremaining” though.