JS not linking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

JS not linking

In my code, the javascript simply refuses to link. The code does not run on its own, and whenever I try to call anything with HTML it gives an uncaught reference error. I've tried putting the code in with the html document (tried both the head section and end of the body section, still same error). There is nothing in the code which should cause this problem, it just randomly started occuring.

16th Oct 2016, 9:06 AM
Jayce Rushton
6 Answers
+ 2
Well, we'll see about that. Could you please paste your code here? A reference error happens when you try to use a variable that has not been defined. Maybe you forgot a var somewhere?
16th Oct 2016, 10:01 AM
Zen
Zen - avatar
+ 2
In the teleport function it should be "Math.round", not "round", and in the freeze function, it should be "if(false)", not "if false". Also you have a function named "freeze" and a variable named "freeze", so you have a nameclash there. Rename either of them! Pro tip: The developer console tells you exactly which line the error is on.
16th Oct 2016, 1:23 PM
Schindlabua
Schindlabua - avatar
+ 1
Hi Jayce, I agreed with Zen. Please, do whatever you did before on code playground, save your code and paste the link here so we can take a look and give you suggestions.
16th Oct 2016, 10:42 AM
Nelson Urbina
Nelson Urbina - avatar
+ 1
I doubt that you typed that code yourself. What's the source?
16th Oct 2016, 1:18 PM
Zen
Zen - avatar
+ 1
Ah thank you. I remember noticing the Math.round problem and fixing it, but I mustnt have saved it. Anyway, its now working.
16th Oct 2016, 1:27 PM
Jayce Rushton
+ 1
Also Zen, I actually did write this code myself, you can search it on google and you wont find any results.
16th Oct 2016, 1:28 PM
Jayce Rushton