Q:

Confused by javascript's constructor and prototype?

function MyObject(){}
Array.prototype={};
MyObject.prototype={};
var a=new Array();
var b=new MyObject();
alert(a.constructor==Array);//true
alert(b.constructor==MyObject);//false

A:

Array.prototype is a non-writable property.
As such, your assignment:
Array.prototype = {}

...doesn't succeed, and so its .constructor property hasn't changed.
15.4.3.1 Array.prototype

The initial value of Array.prototype is the Array prototype object (15.4.4).
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }

...whereas with your custom constructor, you have the ability to assign a different prototype object, so you've overwritten the original which had reference to the constructor via .constructor.

