Refactored method to use ternary operator
Linted the js files. Mainly removed unecessary spaces, semicolons on top level objects and identity checks instead of equality checks