+ 2

Can a boolean be also open/closed?

13th Sep 2016, 8:55 PM
Jason Bohannon
Jason Bohannon - avatar
3 Respostas
+ 2
Yes. A boolean can represent anything that has only 2 different states. var open = true; open = false; //closed
14th Sep 2016, 8:51 AM
Zen
Zen - avatar
+ 2
You will only be able to compare open/closed as boolean if you declare both an open and closed variable var open = true, closed = false; if (open) { document.write('open'); } If you don't declare the variables, open will be undefined
14th Sep 2016, 7:44 PM
Doc McStuffins
Doc McStuffins - avatar
- 1
yes ,of course.
22nd Sep 2016, 6:40 PM
ABHISHEK GOEL
ABHISHEK GOEL - avatar