0

If either of these two are true, i want to break out of the while loop. If either is not true, i want to re ask the question until they give a true answer. I am getting 'Type Error Cannot read property 'toLowerCase' of null' even though the variable is not null. I tried this in many different ways, cant get it to work. Please help, Thanks!

var newShape = prompt('shape please');

while(newShape.toLowerCase() !== "triangle" || newShape.toLowerCase() !== "square") {

    alert('no');
    newShape = prompt('shape please');

}

This works perfectly fine checking just one logic such as this example;

var newShape = prompt('shape please');

while(newShape.toLowerCase() !== "triangle") {

    alert('no');
    newShape = prompt('shape please');

}

I Would like to be able to add more logical operators

0 Answers0