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

what is wrong with this javascript code?

if 2=1+1( "yes" )

else (
    "miscalculation"
    )

6 Answers

I think your missing your brackets, try this and see if it works for yeah.

if (2 === 1+1){
console.log("yes");
}else{
 console.log("miscalculation");
}

hope this helps

can you past the entire code your working on?

Stephanie Fuda
Stephanie Fuda
7,749 Points

Hi, can you try:

else { "miscalculation"; }

thank you. However, it still does not work.

never mind. I did something wrong. It did work. Thank both of you guys so much. A real life saver.

no problem I hope everything works out =D!!!