vendredi 25 août 2017

How to fix this IF statement? HELP ME

The problem is when the answer is null it should show as "firstname/lastname/height not supplied", but it is not working. I think the problem is somewhere within the IF and ELSE statements....

     var firstname;
     var lastname;
     var height;

firstname = prompt("Please enter first name of player 1", "");
if (firstname != null || firstname != ""){ 
    document.writeln("<td>" + firstname + "</td>");
     }
     else 
{document.writeln(firstname = "First name not supplied");}

lastname = prompt("Please enter Last name of player 1", "");
if (lastname != null || lastname != ""){ 
     document.writeln("<td>" + lastname + "</td>");    
     } else 
{document.writeln(lastname = "Last name not supplied");}

height = prompt("Please enter height of player 1", "");
if (height != null || height != ""){ 
    document.writeln("<td>" + height + "</td>");
     } else 
{document.writeln(height = "Height not supplied");}

Aucun commentaire:

Enregistrer un commentaire