0

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?

citronic
  • 9,868
  • 14
  • 51
  • 74

1 Answers1

5
'a'.charCodeAt(0) - 'b'.charCodeAt(0)
Crescent Fresh
  • 115,249
  • 25
  • 154
  • 140
moonshadow
  • 86,889
  • 7
  • 82
  • 122