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

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops A Closer Look at Loop Conditions

https://w.trhou.se/mhgyq2jwbk I can't figure out what the console doesn't like about this code. Please help.

3 Answers

I did fix it in the end. Here is the final product: https://w.trhou.se/63cllpvvlc

I haven't looked to see what's different.

Steven Parker
Steven Parker
229,644 Points

You effectively addressed all the issues I pointed out. Good job. :+1:

Steven Parker
Steven Parker
229,644 Points

You have some syntax errors.

This scripts.js code seems to be good, but the code in number2.js has some syntax errors. It redfines "randomNumber", which was already defined as a function in scripts.js. But it tries to define it two times, once as a function and again as a variable. You need to make sure each of your names is unique, and unique across both files if you are going to load both JavaScript files at the same time.

There also seems to be a missing brace ("}") at the end of the second "randomNumber" function definition.

I changed the names around, but in the video. In the video there is no brace. I have added and subtracted the brace in many ways and it still does not work

Steven Parker
Steven Parker
229,644 Points

The close brace should be on line 15 of number2.js. But you'll still need to fix the other syntax errors.

My code won't run.

https://teamtreehouse.com/workspaces/31426342

check the console - nothing, run the code with Atom it works. Not sure what's wrong.

Steven Parker
Steven Parker
229,644 Points

You can't share a direct URL to your workspace, it's temporary and only exists while you are using it.

But you can use the snapshot function in the workspace and provide the link to that.

You'd also have a better chance to get a rapid response if you start a new question instead of adding to one already answered.