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

Don't know where is the error

I am having this error: Uncaught SyntaxError: Unexpected token '{' (in line 12), but I am not able to catch the error in the code:

function randomNumber(lowerNumber, higherNumber) {
  if ( isNaN(lowerNumber) || (isNaN(higherNumber) ) {
    throw Error('Both arguments must be numbers.');
  }
  return Math.floor(Math.random() * (higherNumber - lowerNumber) + 1)) + lowerNumber;
}

console.log( randomNumber(1,'four') );

1 Answer

Robert Manolis
STAFF
Robert Manolis
Treehouse Guest Teacher

Hey Fran Canete , it looks like you have one too many closing parens after the + 1 in the return statement. :thumbsup: