JavaScript/HTML model of NAND logic gates

Inspired by the description of logic gates in the book "But How Do It
Know"