[SOLVED] Undefined Error

I am having an issue with some code. Whenever I run it, i get an error saying Population is undefined in setup.
The code is at the github link below.

1 Like

I think it has to do with the order of things that you load within index.html. You load sketch.js before Population.js, so at the time you load sketch.js there was nothing before it that defined Population.js.

I suggest putting the <script language="javascript" type="text/javascript" src="sketch.js"></script> line at the end of the <script... wall instead.

That didn’t seem to fix it. :frowning:

I have found the problem! I was changing the code from java, and instead of var I accidentally said the class name.

1 Like

Oh. Glad that thing got resolved.

Care to change thread title to say [Solved] or something, so that people wouldn’t start writing more possible solutions?

1 Like