Javascript Short Circuit Operators (||, &&)

The || operator is used for setting default values.

var name = persons_name || "John Doe";

This code is the same as

if (persons_name) {
	var name = persons_name;
} else {
	var name = "John Doe";
}

var name = person && person.getName();

This code is the same as

if (person) {
       var name = person.getName();
}