What objects are created initially by compilers(?) of javascript?
I’ve been learning Io in order to understand prototyping languages. After doing a bit of research I’ve found the javascript ‘Global Object’. What I can’t seem to wrap my mind around is where the other built-in functions/prototypes/objects are coming from.
There is a print object and I have no clue where it was created. Was it created by the v8 engine I am using to run the javascript code?
And similarly, I’m a bit confused as to which objects are created in a browser initially. I understand that the browser creates a dom in javascript. For example, the document object. But what other objects are there?
Also, in Io it is possible to view all objects that have been allocated memory. This is accessed through the Lobby. Is there something similar in javascript?
My favorite reference on javascript in a browser, global objects and DOM objects is MDN.
The browser creates a whole bunch of objects and makes them available for javascript access. They are created by the browser (not by the javascript engine as they aren’t officially part of javascript), but the browser makes them accessible from javascript.
For example, the browser creates a
documentobject, awindowobject which serves as theglobal objectin the browser and adds a whole bunch of properties to thewindowobject.You can see a list of enumerable properties on the
windowobject in your particular browser from this sample app: http://jsfiddle.net/jfriend00/nh39F/Javascript, by itself, has some objects is creates just for it’s own management of functionality. For example, there is usually a
Mathobject that contains a bunch of math methods and a Date object that contains a bunch of date functionality.