Reputation: 11
I want to use Binary or Octal code like this hex code,
var ab=["\x61"];
document.write(ab[0]);
Upvotes: 1
Views: 147
Reputation:
You are able to use octal and binary in JavaScript (at least since ES2015) by starting numbers with 0b and 0o. For example:
console.log("\x61"); // hex (a)
console.log(0b11); // binary (3)
console.log(0o11); // octal (9)
Upvotes: 1