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 trialTiago Cardoso
1,329 PointsStrange error on console
I don't get it why it says that need to put other "{" and I noticed that both "{" from the function like don't "recognize" each other, and I think that might be the problem
1 Answer
andren
28,558 PointsThe issue is that you are missing a closing parenthesis ) for your if
statement:
if(isNaN(lower) || isNaN(upper)) { // You were missing a ) on this line
return("There's an error, one of this is not a number");
} else {
return Math.floor(Math.random() * (upper - lower + 1)) + lower;
}
The reason why you need two closing parenthesis in a row is that the first one closes the parenthesis of the isNaN
function while the second closes the parenthesis for the if
statement itself.
Tiago Cardoso
1,329 PointsTiago Cardoso
1,329 PointsHoly!, ahah Thank u a lot, I checked the whole program for like 15m . I programmed like 2 months, in school ,my teacher told me that the smallest things are the worst, looks like here they are. :) Thank you