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 Basics (Retired) Storing and Tracking Information with Variables Review Creating and Naming Variables



Binary to octal conversion

The process is the reverse of the previous algorithm. The binary digits are grouped by threes, starting from the least significant bit and proceeding to the left and to the right. Add leading 0s (or trailing zeros to the right of decimal point) to fill out the last group of three if necessary. Then replace each trio with the equivalent octal digit.

For instance, convert binary 1010111100 to octal:

001     010     111     100
1        2       7      4

Therefore, 10101111002 = 12748.

Convert binary 11100.01001 to octal:

011     100      .      010     010
3       4    .           2      2

Therefore, 11100.010012 = 34.228.

Binary octal looks alot like cellular automata!!!!


ECMA 6 0b111110111 === 503 0o767 === 503

ECMA 5 parseInt("111110111", 2) === 503; parseInt("767", 8) === 503; 0767 === 503; // only in non-strict, backward compatibility mode

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Numeric_literals var n = 0O755; // 493 var m = 0o644; // 420

// Also possible with just a leading zero (see note about decimals above) 0755 0644

5 Answers

Steven Parker
Steven Parker
229,644 Points

I thought your examples were wrong until I realized the last digit was supposed to be a subscript!

But anyway .. did you have a question that relates to the quiz you linked to?

you know what is funny "\u{20BB7}".length === 2 weird heh?

if you copy and paste the "\u{20BB7}" it will make the the blog time out and crash? hahheh

are you a 0 or 1 in the workspace first digit/ im https://teamtreehouse.com/workspaces/15210282#

are you a 0 or 1 in the workspace first digit/ im https://teamtreehouse.com/workspaces/15210282#