What Does the "0x" Prefix Mean in JavaScript?

Find out what "0x" means in JavaScript

In JavaScript (and almost all other programming languages), 0x is used to indicate that all subsequent characters should be interpreted as hexadecimal (base 16 number system). For example:

console.log(0x20); // 32
console.log(0x6b6c); // 27500

You can also convert a number into its corresponding hexadecimal value in the following way:

console.log(Number(32).toString(16)); // '20'
console.log(Number(27500).toString(16)); // '6b6c'

Hope you found this post useful. It was published . Please show your love and support by sharing this post.