This means that the index is optional parameter and you can omit it if you don’t use it. Instead, it will start from the index you specified and ignore all values or items that exist in the array before this index.Īs I mentioned, includes() method takes the beginning of the array as the default place to start from. ![]() In that case, includes() method will not start from the beginning of the array, which is the default. What’s more, you can also specify at which index should includes() start to look for that value or item. Instead, you can use includes(), specify the value or item you are looking for and let JavaScript do the rest. You don’t have to use loops or any other iterators and bloat your work with unnecessary code. ![]() This method called includes() provides a fast way to find if an array contains specific item, or value. If you work often with arrays, you may find this ES6 feature useful. Explore the world of ES6 and learn how to write Modern JavaScript!ĮS6, ES7, ES8 & Writing Modern JavaScript Part 1 (Scope, let, const, var).ĮS6, ES7, ES8 & Writing Modern JavaScript Part 2 (Template literals, Destructuring & Default Params).ĮS6, ES7, ES8 & Writing Modern JavaScript Part 3 (Spread, Rest, Sets & Object Literal).ĮS6, ES7, ES8 & Writing Modern JavaScript Part 5 (WeakMap, WeakSet and Export & Import).ĮS6, ES7, ES8 & Writing Modern JavaScript Part 6 (Arrow functions & Promises).ĮS6, ES7, ES8 & Writing Modern JavaScript Part 7 (Async/await & Classes). This part will help you understand ES6 features such as includes(), padStart(), padEnd(), new loops and also map() and … Map. It brought many features that made developers’ lives easier. ![]() ES6 made JavaScript better and more mature programming language.
0 Comments
Leave a Reply. |