<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test js</title>
</head>
<body>
<h1>JS Test</h1>
<script>
var arr = [
'Dell',
'HP',
'Apple',
'Acer'
];
var map = {
0: 'DELL',
1: 'HP',
2: 'APPLE',
3: 'ACER'
};
console.log(arr[1]);// HP
console.log(map[1]);// HP
console.log(arr[01]);// HP
console.log(map[01]);// HP
console.log(arr['1']);// HP
console.log(map['1']);// HP
console.log(arr['01']);// undefined
console.log(map['01']);// undefined
</script>
</body>
</html>
慕村9548890
相关分类