views:

71

answers:

1

I'd like to get a javascript numeric representation for a letter to do some relative manipulation i.e. in pseudocode to conduct an operation like 'a'.getNumberRep - 'b'.getNumberRep.

Best way to do this in js?

+4  A: 
'a'.charCodeAt(0) - 'b'.charCodeAt(0)
moonshadow