I don’t understand the difference between native objects and host objects in JavaScript. Does the latter simply refer to non-primitive function objects that were created by a custom constructor (e.g., var bird1 = new Bird();)?
I don’t understand the difference between native objects and host objects in JavaScript. Does
Share
Both terms are defined in the ECMAScript specification:
Source: http://es5.github.com/#x4.3.6
Source: http://es5.github.com/#x4.3.8
A few examples:
Native objects:
Object(constructor),Date,Math,parseInt,eval, string methods likeindexOfandreplace, array methods, …Host objects (assuming browser environment):
window,document,location,history,XMLHttpRequest,setTimeout,getElementsByTagName,querySelectorAll, …