Anyone else working on the pool game?

Hey all! I recently got my front-end certification and have since started working on other projects, like this pool game, but I’ve run into something confusing. I’m about 22 minutes into the video, and this is still pretty far over my head so I’m following along very very closely, as in my code is identical to that of the tutorial. So I’m about 22 minutes in, and trying to test the code so far, but it seems that in both my code and the original, we’ve written an undefined function. The only difference is, it doesn’t seem to be a problem in the tutorial, and for me, it breaks everything.

If you take a look at the assets.js file, on line 9, I have a function called “callback” that isn’t defined anywhere else, as far as I can tell.

This is a tricky question for me to ask, because I sort of know what the problem should be but I’m baffled as to why it doesn’t seem to be a problem in the tutorial example. I’d love it if someone else who might be following this tutorial (or just someone helpful enough to take a look at it) could explain to me what’s going on? Thanks in advance!

The ‘callback’ variable you use in line 9 is defined ( as a parameter) in line 4.
The ‘callback’ variable you use in line 30 ( passing it as an argument to the function ‘assetLoadingLoop’ ) is defined as a parameter in line 13.

When, in another part of the code, you will call the ‘loadAssets’ function you will pass it an argument ( a function ) which will be passed into the ‘assetLoadingLoop’.

What’s the error you went into?

Here is a link to the github repo. assets.js is the file in question.

in the firefox console I get the following error:

TypeError: callback is not a function[Learn More]
assets.js:9:5

Mh…i just cloned the repo, started the index.html and the only warning is about the charset ( it might be put into the and the warning disappear) … no callback stuff around for me :confused:
Am i missing something?

that’s what I’m wondering. You cloned the repo from my github, right? This is what it looks like when I open the index.html on my browser and take a look at the console.

That is what I have so far. I think I’ve only gotten as far as the basic code layout in the tutorial. What would you like to look at that you’re missing? I’d be happy to send it along.

Well, unbelievable :open_mouth:
I cloned your repo and this is my console with every log open:

Let me clone it again…
Nope, no errors about callback I’m sorry :confused:

I have another theory. I’m working in Linux (ubuntu) so I’m thinking perhaps this has something to do with file permissions, like maybe firefox can’t see something that it needs to…?

Mh I don’t think so, probably you would have alerted with another kind of message when the html will try to load a script if it can’t read it; anyway I’m not sure about that, so give it a check!
On my system permissions for those six files are set to read/write for the owner and read for group/others - the owner it’s me.

Hi @KayDeeJay :slight_smile:

Did you manage to solve the issue?

Please be aware that there are some differences between the code written during the tutorial, and the one displayed on my GitHub repository.

In my opinion it is possible that instead of writing the following line on “index.html”:
loadAssets(PoolGame.start);

You accidentally wrote:
loadAssets(PoolGame.start());

That could cause sending ‘undefined’ instead of a callback function.
Could that be the case?

Please let me know if any further support is needed.

Chen.