+ 2
Can a boolean be also open/closed?
3 ответов
+ 2
Yes. A boolean can represent anything that has only 2 different states.
var open = true;
open = false; //closed
+ 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
- 1
yes ,of course.