quote:
Originally posted by waterbottle
code:
function charCodeAtTest( n ){
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //Initialize variable.
return str.charCodeAt(n - 1); //Return Unicode value of the character.
}
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
return '' + charCodeAtTest(Message.charAt(0));
}
Anyone know what I'm doing wrong?
In that code you are passing a char (or a 1 byte string) to the function, you are then treating it as an integer when you subtract one. And if im not mistaken the n - 1 part would equate to NaN (not a number) because you are subtracting one from a string. I don't really understand what you are trying todo so i can't really give you any tips