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

Pablo Grippo
Pablo Grippo
25,765 Points

I'm having a problem to convert an octal number literal for 16. Please help me!

It throws me an error like this: "mevol" does have the decimal value 16 but should be declared using an octal literal, i.e., a number starting with a zero followed by any number of digits using characters 0 to 7.

I did this: var mevol = 0x10; (But it doesn't work)

3 Answers

Hi Pablo,

Try this:

var mevol = 020;

You used a hexadecimal number, starting with 0x. The octal number starts with a 0 but doesn't use the x

That is the correct hexadecimal number. Reply back if you can't figure out the correct octal number.

Pablo Grippo
Pablo Grippo
25,765 Points

I write var mevol = 14;

But it throws me an error like this: Bummer! Oops! You've set "mevol" to the decimal number 14 which is the octal literal 016. Try setting it to decimal number 16 by adding 2 to your octal literal 016.

How convert 016 to a decimal number 16 by adding 2? Thanks a lot!