最近在前端開發中,遇到一個JavaScript 的問題。
<script type="text/javascript">
var arrayList = new Array();
arrayList.push(1);
arrayList.push(2);
arrayList.push(3);
arrayList.push(4);
arrayList.find(function (val) {
if (val == 4) {
console.log('This is a test');
}
});
</script>
用Chrome,Firefox,運行結果正常。但是在IE里面確出現了"對象不支持find屬性或方法"的錯誤.
看了下官方文檔才發現他是不支持IE的。
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

