January 2020
Intermediate to advanced
548 pages
13h 36m
English
The void operator will evaluate to undefined regardless of its operand. Its operand can be any valid reference or expression:
void 1; // => undefinedvoid null; // => undefinedvoid [1, 2, 3]; // => undefined
It doesn't have many uses nowadays, although void 0 is sometimes used as an idiom for undefined either for succinctness or to avoid issues in legacy environments where undefined was an untrusted mutable value.
Read now
Unlock full access