Having problem with if else on JS

Printable View