0
Why is this not working
The if statement isnt outputing sadly https://code.sololearn.com/W5n78F6fIgkI/?ref=app
10 ответов
+ 1
https://code.sololearn.com/W7q0GbkyB4rR Updated link
This is what i've modified yours to look like. It seems thaat you were checking if a NOT equal "" and NOT equal null, but then truthing that to "A was not entered". Well if it doesn't equal "" AND or even OR null, then it was entered. You might have meant to use === instead of !== and || instead of &&.
That will make it so that if (a equals typeOf string '' OR a equals typeOf null) THEN {true statement (a had not content)} ELSE {false statement (a had content)}
+ 1
Harry Gray Thanks for the help on this problem. I think that fixed my problem😅
+ 1
@Coming In Second Remember, if you're prepending ! in front of an = you're attempting to make sure that the comparison is NOT the expected output.
On line 12 you run your first if chain statement. Because it doesn't the first if is true(it's NOT null or "") the rest of them aren't even processed.
0
So, once you've stored your captured prompt values in variables, I'd process them with code after that before attempting to print anything using the write method. It seems to me as if your script is printing what it doesn't have before it can be handled by your if statement.
The if statement was outputting for me fine, what exactly do you want it to do? :)
0
Harry Gray My if isnt even working, if i click cancel or okay with nothing typed in The document.write I have isnt printing which means that the if isnt catching that variable a has nothing.
0
Oh, actually, it's because you're checking for && when you should be using || for or. What you're looking for is no text but still string and a null value. Those are two different types. Sorry I didn't notice it before haha. As for the rest of the problem, I wish I could open this section on my computer... Wait can I?
Ahh I totally can! Okay give me a bit with the code :)
0
https://code.sololearn.com/W5n78F6fIgkI/?ref=app
It doesnt work now
0
👏I was laughing at that when I realised that I was being stupid
0
Hey don't stress it! We all get caught up on issues and errors haha. Happens to the best of us around the board. Sometimes what works best for me is to walk away from it for a bit and come back hah. I've solved a lot of problems that way. Never give up though!
0
Harry Gray Thanks for the vote of confidence! Im kinda new to javascript still but the === operator I must have skimmed over