updated javascript

jslint applied