- 489
- Central Coast,
Hi all.
I'm in the process of learning JavaScript
I'm writing a javascript program for an assignment, and I can't seem to get my looping working correctly
I'm trying to terminate the loop if the phrase 'Quit' is entered in the name prompt (1st prompt)
I am then trying to get it to continue if either 'I', 'i', 'D' or 'd' are entered in the next prompt. If one of these characters is not entered, it is supposed to reset the loop, and return to the first prompt
I have consulted my class notes, the internet and other resources, but just cant seem to get it to work
all variables are declared, and all statments are ended correctly with a }
I'm in the process of learning JavaScript
I'm writing a javascript program for an assignment, and I can't seem to get my looping working correctly
I'm trying to terminate the loop if the phrase 'Quit' is entered in the name prompt (1st prompt)
I am then trying to get it to continue if either 'I', 'i', 'D' or 'd' are entered in the next prompt. If one of these characters is not entered, it is supposed to reset the loop, and return to the first prompt
I have consulted my class notes, the internet and other resources, but just cant seem to get it to work
all variables are declared, and all statments are ended correctly with a }
Code:
while (cont = true){
name = prompt('Enter customer name (type \'Quit\' to cancel)', 'Name');
if (name == 'quit' || name == 'Quit' || name == 'QUIT'){
cont = false
}
else {
cont = true
type = prompt('Enter the customer type: (Industrial [I] or Domestic [D]', 'D');
if (type != 'I' || type != 'i' || type != 'D' || type != 'D'){
invalid = invalid + 1
}
else{
*other statements*
}
}