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!
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

Tony McCabe
8,445 PointsCreate a Variable named "mevol" and assign the value 16 to it using an octal number literal
octal number literals // 06 === 6 // 07 === 7 " " " " 012 === 10 013 === 11 " " " " My code was: var mevol = 018; before used: var mevol = 016; and the error message say's add 2 to the decimal number 016. I added two accord to the chart above but keep's comming up with error code <code> var = 021 </code> what am I doing wrong tried many different ways including 0216 and many more
9 Answers

Jamie Hinojosa
6,982 PointsJames, does this help? You can see the pattern here. Rember it's base 8. 07=7 010=8 011=9 012=10 013=11 014=12 015=13 016=14 017=15 020=16 021=17 022=18 023=19 024=20 025=21 026=22 027=23 030=24

Kyle Brooks
6,753 PointsTony, you have to add two for each octal. In this case, it would be adding 4, which should give you var mevol = 020 (If I recall my answer correctly on the code challenge).

Bob Sutherton
20,160 PointsBut why is this? I was following the same logic as Tony which says that if 01 = 8 then 018 = 8 + 8 which should give 16. What are we missing? Why do you suddenly add four places instead of two?

Andy Hammond
5,415 Points018 wouldn't technically exist because Octal only goes until 7. (0 1 2 3 4 5 6 7 and restart.)

Tony McCabe
8,445 PointsNice thanks very much!!

Kyle Brooks
6,753 Pointsnot a problem.

Gerardo RodrÃguez
Courses Plus Student 2,722 Pointsvar mevol = 020;

Raymundo Figueroa
Front End Web Development Techdegree Student 25,606 PointsTHK JAMIE, TIL CONFUSING.

Sherrie Gossett
14,924 PointsThink of the "2" (in the answer 020) as representing two "8"s. So 0 + two 8s = 16 + 0 = the answer: 16. Another example: 030. Think of the 3 as representing three 8s or 24. So 030 = 24.

Dewi Tjin
2,275 PointsWhen would you even need to use this?

Sherrie Gossett
14,924 PointsApparently, per the video, it's rare in JS. It seems the information was included so that coders will avoid placing a zero before their numbers. Found this on stackoverflow: "Octal is used as a shorthand for representing file permissions on UNIX systems."

Daniel Davison
Courses Plus Student 5,759 PointsThis had me stumped also, darn octal numbers!

Regan O'Neill
12,714 PointsThank you for your help here! The video did a poor job of explaining how this works. In order to be more helpful and communicate the nature of octal numbers, they should use another example than just numbers with a middle digit of 1 - For example) 012, 015, etc.
Ismael Uriarte
10,403 PointsIsmael Uriarte
10,403 Pointswell said Jamie. thanks
Blair Owens
8,235 PointsBlair Owens
8,235 PointsThanks!
Anish Hallan
2,334 PointsAnish Hallan
2,334 PointsHow would this work for 4 digits? I understand how it works for 3 but cannot work out how it would work for 4.
Thanks in advance
Michelle Pepe
Courses Plus Student 2,076 PointsMichelle Pepe
Courses Plus Student 2,076 PointsThanks Jamie