updated script.js

updated script.js file with comments for the code