fixed JavaScript style guide issues. added JavaScript try-catch block.

fixed JavaScript style guide issues.
added JavaScript try-catch block.