课程: JavaScript Essential Training
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Arrays in code
- [Instructor] An array is an instance of the array object and we declare a new array by creating a variable then using square brackets to wrap around a comma separated list of each of the items within that array. So each of these items take up a slot in the array. If we console.log out an array in the browser, you can see here we have an array with four items and we got a list of all four of those items and you clearly see that we can mix different data types with the same array, so we have a string, we have a variable that pulls in the string, and we have a number and we then have a boolean value. Also notice at the bottom we have a property in the array, and it's the length property that gives us the total length of the array. So if I instead go here and say collection.length then we just get the number signifying how long that array is and how many items are in the array. To access a specific item within an array,…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。