Skip to content

Where is low level code of Javascript standard built-in objects?

I’m looking for the way to get low level code of javascript built-in function.
For example, there is an polyfill(I want like this form and I call this low level code in my way) in mdn site of ‘Array.prototype.indexOf()’
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)

And I get to understand that it is kinda low level code of built-in method.
Here is my question, where can I see the code to look inside of method of ‘String.prototype.toLowerCase()’?

Answer

It’ll depend on your javascript implementation.

For V8, here is the guts of toLowerCase (and toUpperCase)

Low level functions (such as these) are generally written in whatever language the javascript engine is written in – that’s why they’re so fast. So don’t go in expecting something that’s easy to read for the average javascript-only developer 🙂