I have made this sandbox test:
<html>
<head>
<title>whatever</title>
<script type="text/javascript">
function myLittleTest() {
var obj, arr, armap;
arr = [1, 2, 3, 5, 7, 11];
obj = {};
obj = arr;
alert (typeof arr);
alert (typeof obj);
// doesn't work in IE
armap = obj.map(function (x) { return x * x; });
alert (typeof armap);
}
myLittleTest();
</script>
</head>
<body>
</body>
</html>
I realize I can use jQuery's function $.map for making that line of code work, but, what am I missing on javascript datatypes?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…