29. Logical ops and value evaluation #

Created Thursday 3 March 2022

In JavaScript, the logical AND and OR have special meaning.

function f(name) {
	name = name || '<Default Name here>';
}
f(); // if nothing is passed, name = undefined, so the string is returned

In short AND and OR are logical operators, but they don’t necessarily evaluate toBoolean values.

Note: In ES6+ functions, default values can be placed in params with the assignment operator, and OR is not needed.