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

Can't get past questions: Create a variable named "nineteen" and assign the correct numeric value 19...

Seems there's multiple ways to order the variables and get the correct answer, but I can't find the right order the system wants to let me past.

This shows correct in the console when replacing variables with the numbers: ((a+b)*(b+c))+a //forgot the +a in first post

Console shows 19, but not correct answer? (note: a=1, b=2 and c=4 already)

4 Answers

I got it... had to break each answer out under it's own var declaration for it to pass, so answer of var nineteen = (a + b) * (b + c) + a; actually passed.

Hi Michael,

That works for me. Did you assign it to the variable nineteen?

var nineteen = ((a+b)*(b+c))+a;

Charles Gray
Charles Gray
19,470 Points

order of operations is 3 * 6 + 1 = 19 should be right but a javascript variable starts with the keyword var var nineteen = ((a+b)*(b+c))=a;

Yeah, I was being a little short in my question because I hadn't actually copied my work to the clipboard yet. I think it's a technical glitch, though, because after posting I had to refresh the page and I can't get past question 2 now in the same challenge.

var a = 1, b = 2, c = 4, three = a + b, ten = (a + c) * b;

Challenge is for var ten to equal 10.

What you have for ten is correct too. I would try refreshing the challenge.