added js testing module to test.html
added the scratchpad code in a dedicated test.js
used .call method instead of parens function object calling for the event callbacks