- ES6 provides support for Numeric literal like Binary,Octal and Hexadecimal number.
- The symbols for representing binary,octal and hexadecimal numbers are 0b,0x,0x respectively.
- In this demo,”We will learn about ES6 Numerical Literal”.
- The following code contains the Binary,Octal and Hexadecimal representation of decimal number 17.
var aBinaryNumber = 0b10001; console.log("BINARY 0b10001 in DECIMAL: "+aBinaryNumber); var aOctalNumber = 0o21; console.log("OCTAL 0o21 in DECIMAL: "+aOctalNumber); var aHexaNumber = 0x11; console.log("HEX 0x11 in DECIMAL: "+aHexaNumber);
- The output of the previous can be found in the following ES6 fiddle.