refactor script.js to use $