September 2017
Intermediate to advanced
216 pages
6h 8m
English
The best way to think about concatenating lists together is as basic addition. You're effectively adding lists together, resulting in a larger list. You use the concat() method to concatenate lists:
const myList1 = List.of(1, 2, 3);const myList2 = List.of(4, 5, 6);const myList3 = List.of(7, 8, 9);const myCombinedList = myList1.concat( myList2, myList3);console.log('myList1', myList1.toJS());// -> myList1 [ 1, 2, 3 ]console.log('myList2', myList2.toJS());// -> myList2 [ 4, 5, 6 ]console.log('myList3', myList3.toJS());// -> myList3 [ 7, 8, 9 ]console.log('myCombinedList', myCombinedList.toJS());// -> myCombinedList [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
Now our side-effect only needs to worry about iterating over myCombinedList ...
Read now
Unlock full access