什么是数组,数组和对象之间有什么区别,何时以及为何使用数组?
What is an array, what is the difference between array and objects and when and why use an array?
你好我有几个问题:
为什么是数组?
为什么数组和对象有区别?
为什么以及何时需要使用数组?
感谢您的帮助:);)
数组是一系列没有定义键的值:
['one', 'two', 'three']
一个对象使用键,这些键的值可以是语言范围内的任何值。例如:布尔值、整数、字符串、对象、数组或事件函数:
{
one: {
two: 'three'
},
four: ['five', 'six'],
seven: 'eight',
nine: 10,
eleven: function () {},
}
你好我有几个问题: 为什么是数组? 为什么数组和对象有区别? 为什么以及何时需要使用数组? 感谢您的帮助:);)
数组是一系列没有定义键的值:
['one', 'two', 'three']
一个对象使用键,这些键的值可以是语言范围内的任何值。例如:布尔值、整数、字符串、对象、数组或事件函数:
{
one: {
two: 'three'
},
four: ['five', 'six'],
seven: 'eight',
nine: 10,
eleven: function () {},
}