learning Javascript by implementing chess