|
|
|
|
|
by elnygren
3173 days ago
|
|
foo = foo || {}
"mark foo as being foo if it is already defined or as an empty new object {} if it is not"It's just to not accidentally set a already defined foo as an empty object incase foo is already defined. Yeah... JavaScript... Another common idiom: const PORT = process.env.PORT || 8080
The || (logical OR) can be used for setting a default incase the value before it is falsey (null, undefined, false...). |
|