what does 0X mean? I saw it mentioned in class, but my teacher had no idea either. Is it synonymous to the word hexadecimal or does it mean all values? Thanks for your help guys!
Asked
Active
Viewed 1.7k times
12
-
what kind of code is that anyway? – Ya Zhuang Nov 17 '11 at 18:35
-
Probably a prefix to a hexadecimal number. Hard to say without seeing code. – Michael Berkowski Nov 17 '11 at 18:36
-
0x on it's own doesn't mean much, if you say 0x023 it is the hexadecimal equivalent of 35 – Ibu Nov 17 '11 at 18:36
-
1I'm surprised no one has flagged this as a duplicate seeing as how 9/10 of legitimate questions get voted to close. [Why are Hexadecimal Prefixed as 0x?](http://stackoverflow.com/questions/2670639/why-are-hexadecimal-prefixed-as-0x) [where does 0x come from?](http://stackoverflow.com/questions/4257661/where-does-0x-come-from) – puk Nov 17 '11 at 18:46
-
1[What do numbers using 0x notation mean?](http://stackoverflow.com/q/8186965/995714) – phuclv Oct 11 '15 at 03:54
4 Answers
16
Yes, it means the following value is in hexadecimal:
var num = 0xFF; //255 - 1111 1111

CodyBugstein
- 21,984
- 61
- 207
- 363

Nick Rolando
- 25,879
- 13
- 79
- 119
7
Yes, it means the value that comes after '0x' is interpreted as a hexadecimal value.
var a = 0x123;
console.log(a); // output is ((16^2)*1) + ((16^1)*2) + ((16^0)*3) = 291
See also What do numbers using 0x notation mean
Hope that helped.

Harish
- 81
- 2
- 6
6
It means the subsequent characters in the token should be interpreted as heXadecimal
0x20
means the decimal value
32

McKay
- 12,334
- 7
- 53
- 76