Write a draw Chess Board function that accepts one parameter 'canvas' which is a canvas. It should draw an 8x8 chess board of #000 and #FFF squares. The top left corner should be a #FFF square
<table><tr>
<?php
$color = 'black';
function printcolor($color, $nl) {
echo '<td style="width:50px; height:50px; background:' . $color . '"></td>';
if ($nl == true) {
echo "</tr><tr>";
}
}
for ($i=1; $i<=64;$i++) {
if ($i % 8 == 0 && $color == "black") {
$color = "white";
$nl = true;
} elseif ($i % 8 == 0 && $color == "white") {
$color = "black";
$nl = true;
} elseif (isset($nl) && $nl == true) {
$nl = false;
} elseif ($color == "black") {
$nl = false;
$color = "white";
}
elseif ($color == "white") {
$nl = false;
$color = "black";
}
printcolor($color, $nl);
}
Also in JavaScript:
- js array delete last
- express req get json
- react native create button
- eval in js
- trigger click on checkbox jquery
- how to loop over dom objects javascript
- js get mic level
- js get current seconds
- js round up decimal
- jquery test div exists
- regular expression |
- javascript function call with variable
- how to check if array
- nativescript angular back button event
- javascript pass iterator to callback
- react 17
- discord js bot leave voice channel
- object object javascript
- install react native
- alternative for componentdidmount
- disable input jquery
- loop over json javascript
- simple node server
- get url params angular