ES6 Tutorial - #7 Iterating Objects & Arrays

preview_player
Показать описание
01:08 for...in loop
03:09 for...in traverses the prototype chain
07:20 for...of (ES6) doesn't iterate plain objects
09:12 jQuery, Underscore, and Lodash
10:44, 11:52 Do NOT use for...in with arrays
14:41 for loop
15:19 Caching the condition
16:28 for loop is imperative (HOW to loop)
17:17 forEach method - ES5
18:56 forEach is declarative (WHAT to loop)
20:02 map method - ES5
22:41 forEach is best for simple iterations with no side effects; map - for processing elements in a functional manner without mutating the original array
23:30 for...of loop - ES6
24:23 for...of does not give access to the indexes
25:02 Alternatives for iterating arrays

This next one is more of a review of pre-ES6 approaches to iterating (aka looping) through objects and arrays. We'll look over for...in, for, forEach, map, as well as the new for...of loop, and a few others. The key takeaway is to stick with for...in when enumerating plain objects, and use either forEach or for...of with array-like objects.

Рекомендации по теме
Комментарии
Автор

I appreciate the time you put in making these videos. You're a nice man. Thanks

simonkalu
visit shbcf.ru