Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jesse Fister
11,968 PointsObject-Oriented JavaScript part 1
I'm working on Randy's Object-Oriented JavaScript Part 1: I'm wondering why my JavaScript code is not working? The HTML file loads correctly in the browser however, none of my JS files seem to be attached.. Below is my html file.
<!DOCTYPE html>
<head>
<script type="text/javascript" src="js/robot.js"></script>
<script type="text/javascript" src="js/maze.js"></script>
<script type="text/javascript" src="js/mazespace.js"></script>
<script>
m = new Maze(7,5);
m.setStart(1,1,"north");
m.setEnd(7,1);
m.setWall(1,1, "east");
</script>
</head>
<body>
<div id="page">
Loading ...
</div>
</body>
</html>
2 Answers
Brian Douglas
822 PointsIt could be that the path to your js files are incorrect.
'js/robot.js' would mean that the js file is in a folder called 'js' in the same folder as the index.html file.
Also I would recommend placing your script tags just before the closing body tag </body>.
joanprim2
7,500 PointsTHIS IS NOT THE PROBLEM. I see now video 22:00 minute where this problem is corrected. I'm so sorry
In MazeSpace.js video 19:45-
line 11: this.["north"] = true; (the dot notation and the bracket notation are not correct)
correct line is:
line 11: this["north"] = true; (without dot)
see the dot notation and the bracket notation fore more information