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

Whats wrong with this code ? It keeps saying parse error

var num1 = parseInt('5');
var num2 = parseInt('3');

function max(num1, num2) {
  if (num1 > num2) {
       return num1;
      } else {
       return num2;
}

2 Answers

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,741 Points

Hey Alejandro,

Make sure your curly braces ({}) are all matched up; the function is missing the closing one. This can be really hard to spot if your formatting is off or you've been staring at it for a bit!

Hope this helps.

yeah i was staring at it for a really long time, thank you !!

Julian Gutierrez
Julian Gutierrez
19,325 Points

Looks like you are missing the closing bracket to your function.