课程: JavaScript: Arrays

今天就学习课程吧!

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

Solution: Basic array methods 1

Solution: Basic array methods 1 - JavaScript教程

课程: JavaScript: Arrays

Solution: Basic array methods 1

(upbeat music) - [Instruction] Welcome to your first challenge in this array methods course. And our first task here is going to be determining the length of the array fruits. So the first thing we'll want to do, and this will be the case in each of our challenges, is we want to make sure we don't forget to return the actual solution so we can check it against the correct answer. So I'm going to go ahead and write return here just so I don't forget. And then we want to know what is the length of the fruits array? So let's go ahead and reference fruits. And then to get the length of the array, we will use the length property. So it's as easy as that. And now let's go ahead and test this code and make sure that it's correct. And very good job. You can see that the length of this array is four.

内容