0

Can a conditional if go inside a variable?

1st Aug 2016, 3:29 AM
Franklin
Franklin - avatar
9 Antworten
+ 1
var x = 5; var y = 6; var bool = x < y; document.write(bool); //true
3rd Aug 2016, 8:46 AM
Lordeblader
0
var x=5 var y=6 var check = (x > y): true ? false
4th Aug 2016, 12:14 PM
vinayak shrivastava
0
all dis answers are outragious, its better u put ur ifs under d function methods
9th Aug 2016, 11:23 AM
Osaji Gabriel
Osaji Gabriel - avatar
0
no you cant do that
15th Aug 2016, 2:42 AM
mekaii gurung
mekaii gurung - avatar
0
var x = 100; document.write(x); var y=90; var z = (x==y) ? "true" : "false"; alert(z);
15th Aug 2016, 5:47 PM
pan Soren
pan Soren - avatar
0
no u cant
21st Aug 2016, 6:22 PM
Dhanshri Bhavsar
Dhanshri Bhavsar - avatar
0
it should be called nested if
21st Aug 2016, 8:40 PM
Osaji Gabriel
Osaji Gabriel - avatar
0
var x = someothervariable || "{}"; you can do something like
23rd Aug 2016, 1:37 PM
Oscar Fernandez
Oscar Fernandez - avatar
- 1
Variables are used to save values. Not conditionals.
13th Aug 2016, 6:38 PM
Melissa Göl
Melissa Göl - avatar