Add a JavaScript version of the sample