September 2017
Intermediate to advanced
216 pages
6h 8m
English
Imagine that you have three separate sources of information for one logical entity. For example, you have the following:
The glue between these lists is their indexes. Using the zip() method, you can bring the values of these lists together, as follows:
const names = List.of('Jeremy', 'Garry', 'Katie');const roles = List.of('Engineer', 'Designer', 'Programmer');const ages = List.of(34, 23, 36);names .zip(roles, ages) .map(v => v.join(', ')) .forEach(v => console.log('employee', v)); // -> employee Jeremy, Engineer, 34 // -> employee Garry, Designer, 23 // -> employee Katie, Programmer, 36
The names list uses the zip() method to join the roles and ages lists together. ...
Read now
Unlock full access