質問

var result ="1fg";
for(i =0; i < result.length; i++){
  var chr = result.charAt(i);
  var hexval = chr.charCodeAt(chr)
  document.write(hexval + " ");
}

This gives NaN 102 103.

Probably because it's treating the "1" as a integer or something like that. Is there a way I can convert the "1"->string to the correct integer? In this case: 49.

So it will be

49 102 103 instead of NaN 102 103

Cheers,

Timo

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top