<html>
<head>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="protovis-r3.2.js"></script>
<title>Array Map Function</title>
</head>
<body>
<div id="pesan1">
</div>
<script type="text/javascript">
var data = [0,1,3,5];
data = data.map(function(x)
{
return 2*x;
}
);
document.getElementById("pesan1").innerHTML = data;
</script>
</body>
</html>
<head>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="protovis-r3.2.js"></script>
<title>Array Map Function</title>
</head>
<body>
<div id="pesan1">
</div>
<script type="text/javascript">
var data = [0,1,3,5];
data = data.map(function(x)
{
return 2*x;
}
);
document.getElementById("pesan1").innerHTML = data;
</script>
</body>
</html>
Result :
0,2,6,10
No comments:
Post a Comment