0

I am going through a Javascript code and encountered the following construct which I am not able to comprehend.

case "RED":
     return (0, h.default)(e);

Please explain what this return type is?

Shashwat Kumar
  • 4,541
  • 2
  • 24
  • 49

1 Answers1

1

The void operator evaluates the appended method but then returns undefined, the return value here is undefined, no matter what (0, h.default)(e) returns.

From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void:

console.log(void 2 == '2'); // (void 2) == '2', returns false
console.log(void (2 == '2')); // void (2 == '2'), returns undefined
Chloe Anderson
  • 329
  • 1
  • 7