Binary
numbers are represented by 0 followed by small (or) capital B followed by the
binary digits.
Example
0b111
0B1010
HelloWorld.js
var x = 0B1010; var y = 0b111; console.log("x : " + x); console.log("y : " + y);
Output
x
: 10
y
: 7
If
the digits after 0b (or) 0B contains non-binary digits (0, 1), then you will
endup in SyntaxError.
No comments:
Post a Comment