Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.