NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# Indices So you have your array of data elements, but what if you want to access a specific element? That is where indices come in. An **index** refers to a spot in the array. indices logically progress one by one, but it should be noted that the first index in an array is 0, as it is in most languages. Brackets [] are used to signify you are referring to an index of an array. ~~~ // This is an array of strings var fruits = ["apple", "banana", "pineapple", "strawberry"]; // We set the variable banana to the value of the second element of // the fruits array. Remember that indices start at 0, so 1 is the // second element. Result: banana = "banana" var banana = fruits[1]; ~~~ Exercise Define the variables using the indices of the array ~~~ var cars = ["Mazda", "Honda", "Chevy", "Ford"] var honda = var ford = var chevy = var mazda = ~~~