Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a problem with extending basic Array implementation in IE7

function extend(Child, Parent){
   var F = function() { };
   F.prototype = Parent.prototype;
   Child.prototype = new F();
   Child.prototype.constructor = Child;
   Child.superclass = Parent.prototype
}

var MyArray = function(){};
extend(MyArray, Array);

var a = new MyArray();
a.push("value");
console.log(a.length);

in all browsers a.length == 1, but in ie7 a.length == 0

please help to resolve this problem

share|improve this question
2  
I don't think you can sucessfully do this in any browser. The special length property of Arrays only applies to real Array objects (i.e. those created by the Array constructor). – RobG Jul 16 '12 at 7:04
@RobG is right. See perfectionkills.com/… – Tim Down Jul 16 '12 at 8:18

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.