开发者

Augment the Array type

I'm trying to augment Array as follows:

Array.prototype.myFunction = function () { return 10; }

But then, the following doesn't work:

var myArray = "Bla"

myArray.myFunction();

What's the stup开发者_如何学JAVAid mistake I'm doing?


Because "Bla" is not an Array. Its a String.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜