今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Does the array Include an element?
- [Instructor] The array method includes checks an array for a specific value. It will then return a Boolean, true or false, to indicate whether or not a value was found within a specific array. The syntax is fairly simple. You pass the array method the value you want to search for in the array. Keep in mind that this value is case sensitive. Additionally, there's an optional parameter called fromIndex, which indicates from what index position you want the method to start searching. For the purposes of this lesson, we're going to focus simply on passing a value to search as this will be the most common implementation of the array method. Let's look at a quick example to see includes an action. We have an array of scores and we want to see if it includes a perfect score of 10. All we have to do is pass the score we're looking for, 10, and the array method will return True, indicating that 10 is included in the array. Now…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。