Condition | SoloLearn: Learn to code for FREE!



Is this possible to make a condition into another condition ?

7/3/2018 9:05:07 AM

Mr. Plopomi

5 Answers

New Answer


conditions just return true or false or 1 or 0 for a computational true or false. so anything that uses that return can have a condition in it. So like function test { return true; } let result = 9 > 3 && test() && !false && 1; is all valid and gives the result of 1 or true. You can use && for and meaning both sides have to result in true and || for or which means AT LEAST one side has to be true for the whole thing to return true. ! is used for not which returns the opposite of the result too. You can do conditions with many parts in for loops, if statements, turnery ifs, print statements, and many more.


If you're referring to nested if-else statements, yes. It's possible have a conditional inside another conditional. You can also do it with ternary operators.


Do you mean have a condition and within that condition is another condition Or do you mean change the condition


Agent i mean something like this : var example = confirm("test1") if (example == true) { var exampleTwo = confirm("test2"); if (exampleTwo == false) { alert("test3"); } else { alert("test4"); } else { alert("test5"); }


okay, thank you =D