Code for the JavaScript activities