JavaScript Reflection with toString
Reflection is an important tool in programming; it lets us examine a language’s structure. Can we reflect in JavaScript? Sort of. Some functions can be reflected with toString(): const one = () => 1; // undefined one.toString(); // '() => 1' Very cool! But native functions only return this: > Math.max.toString() 'function max() { [native code] }' You must read the ECMAScript specification to know what the function is required to do. The actual implementation is written in the JavaScript engine, which for Node is Torque, which is why Node can’t show it via toString().