ES6 Everyday: Binary and Octal Literals

Here’s a nice and easy one to start our week; you can now represent binary and octal numbers with literals:

console.log(parseInt("101011", 2)); // 43
console.log(0b101011); // 43

console.log(parseInt("0543", 8)); // 355
console.log(0o543); // 355

Check it out for yourself in a ES6 Fiddle.

Resources