As you can see in jsfiddle , I have taken two black coins. If I place a black coin on another black coin then it should show alert that "can't kill your own kind" and place the coins in their previous positions. But as you can see it is not working.
I think your problem is that you're looking for an HTML Entity Encoded version of your UTF-8 characters. HTML Entity Encoding uses the form &#XXXX;
, where XXXX
is the decimal value of the entity (in this case, a UTF-8 character code).
On the JavaScript side, you need to be using the JavaScript form of the entity, which is \uXXXX
, where XXXX
is the hexadecimal value of the entity. So by converting your decimal values to hex and putting them in the proper form, your search array should be:
var blackCoins = ["\u265b", "\u265c"];
I'm not sure how the game is supposed to work, but making this change does result in "matches" from $.inArray()
. So I think that's what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With