JavaScript is non-strictly typed language as Java,for example.
As we know, it converts value of result dependently upon context:
\"2\" + \"3\"
r
You can do other things too like:
var myVar = Math.random() > 0.5;
myVar && doFunc();
which is the same as
if(myVar) {
doFunc();
}
The ||
basically means "If the first thing is false, go to second"
The &&
basically means "If the first thing is true, go to the second"
This is why you see things like this at the top of functions:
function myFunction(options) {
options = options || {};
}
Which means: If options is falsey, make it {}