<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function () {
var data = [{
"Id": "SWE",
"Country": "Sweden",
"Population": 9592552
}, {
"Id": "NOR",
"Country": "Norway",
"Population": 5084190
}];
function display(e) {
alert("E" + e);
var countryData = data.find(function (element, index, array) {
return element.Id === e;
});
alert(countryData.Population);
}
display('SWE');
});
</script>
</head>
</html>
The code posted above is working properly on Firefox and Chrome but I get an error in Internet Explorer. Error message:
Object doesn't support property or method 'find'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…