Ondra Žižka Ondra Žižka - 3 years ago 268
TypeScript Question

JavaScript: what does "void 0" mean?

TypeScript transpiles certain code into this:

Animal.prototype.move = function (distanceInMeters) {
if (distanceInMeters === void 0) { distanceInMeters = 0; }

void 0
? Is that the same trick as used for links
? Why is not
used instead?

Answer Source

The void operator always evaluates as the undefined value.

The undefined variable, which defaults to holding the undefined value, can be overwritten.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download