Listing B-1 contains the final JavaScript implementation for the Drag and Drop application that was demonstrated in Chapter 24.
Listing B-1. Chapter 24 source code
"use strict";
function createBoard() {
var board = document.getElementById("board");
for (var y=0; y < 8; y++) {
var row = document.createElement("div");
row.className = "row";
board.appendChild(row);
for (var x=0; x < 8; x++) {
var square = document.createElement("div");
square.id = x.toFixed() + y.toString();
if ((x + y) % 2) {
square.className ...