获取对象中值的两种方法

<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
</head>

<body>
<input type="button" name="" id="btn" value="按钮" />
<input type="button" name="btn1" id="btn1" value="按钮" />
<script type="text/javascript">

var Jsan = {
'arr': [1, 2, 3, 4, 56, 7, 8, 9],
'jasn1': {
'a': '456456456'
}
}
alert(Jsan['arr'][3]);
alert(Jsan.arr[3])


</script>

</body>

</html>

posted @ 2017-03-10 11:12  张正-博客园  阅读(4649)  评论(0编辑  收藏  举报