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 JavaScript Foundations Numbers Creating Numbers: Part 2

Mark Bradshaw
PLUS
Mark Bradshaw
Courses Plus Student 7,658 Points

I'm stuck on a javascript quiz question. Need help.

Create a variable named "mevol" and assign the value 16 to it using an octal number literal.

Here's what I've put in as my answer. var mevol = 0162;

3 Answers

lv
lv
9,230 Points

Mark this drove me crazy. I think the problem might be that we we're looking at the first digit "0" and summing it as 7 rather than the enabler for the Javascript that tells it its working with octals. in Octals (WholeNumber|Octal) 1=1, 2= 2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=10, 9=11, 10=12, 11=13, 12=14, 13=15, 14=16, 15=17, 16=20. Now all you have to do is put a 0 in front of that octal to enable it and you're good.

Mark Bradshaw
Mark Bradshaw
Courses Plus Student 7,658 Points

That was what I needed. I actually figured out the octal chart earlier today, but thanks for the help.

Benjamin Harrison
Benjamin Harrison
10,958 Points

You are correct in putting a leading 0 to show that your number is octal. However the number that you put in does not come out as 16 but as 114.

Benjamin Harrison
Benjamin Harrison
10,958 Points

Remember, every digit is an order of 8. So 07 = 7, 010 = 8, 013 = 11.