Improving the JS code

both ‘===‘ and comments to make it clearer.