views:

296

answers:

2

String.fromCharCode(72) gives H. How to get number 72 from char H?

+4  A: 

Use charCodeAt:

var str = 'H';
var charcode = str.charCodeAt(0);
Tatu Ulmanen
+2  A: 
'H'.charCodeAt(0)
Silvio Donnini