delete redundant "if", "try catch"
add semicolon
remove unused param
Merge pull request #2213 from shikolay/master

Some minor clean up for JavaScript code