function createChess(width, height) {
var pattern = '# '.repeat(Math.floor(width / 2) + 1 );
var odd = pattern.substr(0, width);
var even = pattern.substr(1, width + 1);
var half_height = Math.floor(height / 2);
for (var i = 0; i < half_height; i++) {
console.log(odd);
console.log(even);
}
if ((height % 2) == 1) {
console.log(odd);
}
}
createChess(8,8);
$( "button" ).click(function() {
$( this ).replaceWith( "<div>" + $( this ).text() + "</div>" );
});
$.ajax({
type: "POST",
url: url,
data: {key: 'value'},
dataType: 'json'
});