ES6 Tutorial - #7 Iterating Objects & Arrays
01:08 for...in loop
03:09 for...in traverses the prototype chain
04:38 Object.keys() & Array.forEach() - ES5
07:20 for...of (ES6) doesn't iterate plain objects
08:20 for...of works with Object.keys()
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.
Deep dive into iterables & iterators https://medium.freecodecamp.org/demystifying-es6-iterables-iterators-4bdd0b084082
How to not get caught in the trap of array-like objects http://www.nfriedly.com/techblog/2009/06/advanced-javascript-objects-arrays-and-array-like-objects/
Imperative vs Declarative programming https://tylermcginnis.com/imperative-vs-declarative-programming/
Видео ES6 Tutorial - #7 Iterating Objects & Arrays автора JS Идеи
Видео ES6 Tutorial - #7 Iterating Objects & Arrays автора JS Идеи
Информация
29 ноября 2023 г. 4:14:03
00:26:47
Похожие видео