【发布时间】:2017-03-31 12:31:04
【问题描述】:
我基于此article 创建了一个集合。我发现它可以在 chrome、firefox 和 ie9+ 上运行。 我认为有些事情是行不通的,或者可能,Windows 10 的 ie9 模拟器并没有给我真实的画面。
这个扩展会出现什么问题?
测试代码:
<script>
function Collection() {
var collection = Object.create( Array.prototype );
collection = (Array.apply( collection, arguments ) || collection);
return collection;
}
Collection.prototype = Object.create(Array.prototype);
var collection = new Collection();
collection[0] = 1;
console.log(collection[0]);
</script>
【问题讨论】:
标签: javascript arrays oop