Update 3.js

fixed by adding missing var declarations and semicolons.