In this javascript code if else statement working very well but i don't know why remaining code is not working?

They are optional when there’s only one statement in the block but you never know if you might need to add extra code to the block so having them there already helps you to avoid breaking the code if you do add an extra statement (eg. for quick debugging).

I agree that they should always be included.

1 Like