Hi, I am trying to understand the code in onDragStart Preven Drag. I specifically want to ask what does piece.search(/^w/) mean? Is there any document that I can read? I am right now having a bug that when the player is in check, he cannot make any move. atthattime game.turn() === 'w' and piece.search(/^w/) === 0. Below is my onDragStart function. Could you please help me understanding this? Thank you so much!
"I specifically want to ask what does piece.search(/^w/) mean? "
It checks every string which starts with "w". That's mean It checks whether It was a white piece or not, for example wK, w,Q, wN, wB, wR, wP,
Hi, I am trying to understand the code in onDragStart Preven Drag. I specifically want to ask what does
piece.search(/^w/)
mean? Is there any document that I can read? I am right now having a bug that when the player is in check, he cannot make any move. atthattimegame.turn() === 'w'
andpiece.search(/^w/) === 0
. Below is my onDragStart function. Could you please help me understanding this? Thank you so much!