check with jslint and format code style and modified param not undefined check