created a couple of working examples in JavaScript