+ 4
Condition
Is this possible to make a condition into another condition ?
5 Answers
+ 3
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.
+ 8
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.
+ 5
Do you mean have a condition and within that condition is another condition
Or do you mean change the condition
+ 4
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");
}
+ 1
okay, thank you =D