HTML and CSS Reference
In-Depth Information
> if (!a) {
a = 10
}
Likewise, if you only want to use a variable if it has a value you can write the following:
> if (s) {
console.log(s)
}
This shortcut is enormously useful, and extensively used in JavaScript code.
The final thing that should be understood is which values are equal to one another; the fol-
lowing may come as a surprise:
> null == undefined
true
> 5 == "5"
true
> "true" == true
false
> "1" == true
true
> "2" == true
false
Search WWH ::




Custom Search