137 days ago · Tech · hide · Fediverse post

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 ECMA Script specification to know what the function is required to do. The actual implementation is written in the JavaScript engine, likely in another language like C++, which is why Node can’t show it via toString().

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town