lundi 29 juin 2020

What exactly is Function.prototype()? Is it a suitable default value?

In NodeJS and the browser, if you call Function.prototype(), it returns undefined.

Calling Function.prototype.toString() returns "function () { [native code] }".

Is this an empty function? Is it suitable to use in place of () => {} for defaults (e.g. default prop for React component)?




Aucun commentaire:

Enregistrer un commentaire