ive got an array of cards 2-10 plus jack, queen, king, ace and i’m pulling members from the array at random–in order to score it, i decided to check the first character of the string and see if it returns a number or not.
if it’s a number, add the number to the score, but if it returns ‘NaN’ (not a number) then it will just add 10 to the score–so even tho NaN is defined as a variable in flash, somehow my if statement ‘char==NaN’ isn’t working…
functionÊscoreCard(){
//get first member of string, check to see if its a number
ÊÊÊÊchar=randMember.charAt(0);
ÊÊÊchar=Number(char);
ÊÊÊÊif(char==NaN){
ÊÊÊÊÊÊÊÊtrace("Hi");
ÊÊÊÊÊÊÊÊscore+=10;
ÊÊÊÊÊÊÊÊ}elseÊ//trace(char);
ÊÊÊÊÊÊÊtrace("Lo");
ÊÊÊÊÊÊÊÊscore+=char;
ÊÊÊÊ//trace(score);
}
does somebody have the goods on how to do this right?
i’ve attached a fla of it in the thread titled ‘arrays??!!’
thanks,
-mojo