课程: JavaScript: Arrays

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Length property and direct assignment

Length property and direct assignment - JavaScript教程

课程: JavaScript: Arrays

Length property and direct assignment

- [Instructor] All arrays have a length property. The length property returns the number of items in an array. The value returned is a number. For example, let's consider an array of letters. If we apply the length property to the array, it will return a numerical value that represents the length of the array. Additionally, arrays in JavaScript are zero based. This means that the index position of the first element of the array starts with zero. The second element would have an index position of one and so on. Direct assignment is when you assign data to a specific index position within an array. We have to be careful when using direct assignment because it will override any existing data in that position. It does not shift existing data in the array. It will completely overwrite it. Let's go to the code and see how to apply length and direct assignment in a practical example. Before we get started, I want to point…

内容