Skip to content
Advertisement

moving inline javascript to separate file

I was trying to copy and learn from this turorial: https://www.youtube.com/watch?v=txUvD5_ROIU but I wanted to move the inline javascript to a separate .js file in Visual Studio Code. This made the code run incorrectly and I cannot for my live figure out why. I’ve tried to structure it differently but I’m to unfamiliar with javascript to figure out whats wrong. Here is the code:

JavaScript
JavaScript

Any help is greatly appreciated!

Advertisement

Answer

You have a typo in this line: for (var y = 0; x < mapH; y++)

Here is fixed example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement