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 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
218,692 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#