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 trialMark Bradshaw
Courses Plus Student 7,658 PointsI'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
9,230 PointsMark 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.
Benjamin Harrison
10,958 PointsYou 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
10,958 PointsRemember, every digit is an order of 8. So 07 = 7, 010 = 8, 013 = 11.
Mark Bradshaw
Courses Plus Student 7,658 PointsMark Bradshaw
Courses Plus Student 7,658 PointsThat was what I needed. I actually figured out the octal chart earlier today, but thanks for the help.