什么是数组,数组和对象之间有什么区别以及何时以及为什么使用数组?

时间:2016-07-12 21:47:32

标签: javascript arrays javascript-objects

您好我有几个问题: 为什么是阵列? 为什么数组和对象之间存在差异? 为什么以及何时需要使用数组? 感谢您的帮助:);)

1 个答案:

答案 0 :(得分:0)

数组是一系列没有定义键的值:

['one', 'two', 'three']

对象使用的键值可以是语言范围内的任何值。例如:boolean,integer,string,object,array或event functions:

{
  one: {
    two: 'three'
  },
  four: ['five', 'six'],
  seven: 'eight',
  nine: 10,
  eleven: function () {},
}