I am having a problem identifying a javascript object
function A(x, y){
this.boo = function(){
}
}
var aa = new A("1", "2");
aa.boo();
In the code, is ‘aa’ a javascript object? Does it inherit properties from object.prototype too? If yes, how can I be sure (from a novice).
You can be sure because every native object inherits from Object.prototype (except for the Global object, whose [[Prototpye]] is implementation dependant, but it is an instance of Object in most browsers).
Edit
Some clarifications.
Native objects are those constructed using ECMAScript, e.g.
and so on. They all have Object.prototype on their [[Prototype]] chain, which makes them instances of Object (and whatever other constructor’s prototype is on the chain). An ECMAScript object can inherit from more than one prototype and hence be an instance of more than one object:
Built–in objects are those supplied by ECMAScript, e.g.
and so on. Most of the above are also instances of Function (including Function).
Host objects are those supplied by the host environment, such as everything in the DOM, e.g.
and so on. These object only have to follow the most basic rules of ECMAScript, they don’t need to have any inheritance model and may even throw errors when simply tested with instanceof or typeof operators (which is a nasty behaviour but some versions of some browsers do – many IE host objects implemented as ActiveX controls do, hence their creation within try..catch blocks).
Read the section on “Native ECMAScript Objects” (ES 3) and “Standard Built-in ECMAScript Objects” (ES 5) objects in the specification (ECMA–262), it’s all there.