createVector returning undefined

Hi, I was recently going through one of Daniel Shiffman’s old smart rockets tutorial. My code is very similar to his only with updated syntax. I ran into an error early on which was Uncaught TypeError: Cannot read property ‘add’ of undefined. This happens on line 13. Here is my code.

For some reason all of the vectors created in the constructor become undefined when I reference them elsewhere. I have printed them all out to confirm this. I am using the latest version of Atom on Windows 10 and have tested it with both Google Chrome and Firefox. Hope you can help!

Here is the sketch part of the code:

Please avoid posting code as a picture, b/c they can’t be copied & pasted, and can even be harder to read! :anguished:

Since it’s JS, you should post it as a runnable app on some JS hosting site: :star_struck:

Back to your problem, w/o seeing your “.html” file as well, I can’t pinpoint exactly what is wrong there! :no_mouth:

As an example, the order your “.js” script files are loaded & run might be wrong. :thinking:

For now, you might be interested in seeing a sketch w/ multiple “.js” files loaded from its “index.html” file: :cowboy_hat_face:

Also, there is a p5.js mode that can be downloaded in the Processing IDE as well.

HTML part:

Thanks for the feedback. I added a photo of the html file as well. It turns out the issue is fixed if I switch back to ES5 syntax in Atom and It also works with ES5 syntax in the processing IDE. I don’t understand why it does not work with ES6 syntax. I tried Shiffman’s evolutionary steering with ES6 syntax in Atom and it works fine using the same createVector and add properties.