java-script:map-method
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
java-script:map-method [2023/08/11 16:14] – ↷ Page moved from java-script:string:map-method to java-script:map-method odefta | java-script:map-method [2023/08/11 16:20] (current) – odefta | ||
---|---|---|---|
Line 104: | Line 104: | ||
* This discount is applied to every second product in the array (i.e., the products at index 0, 2, etc.), so the final prices of the ' | * This discount is applied to every second product in the array (i.e., the products at index 0, 2, etc.), so the final prices of the ' | ||
+ | ===== Example 4 ===== | ||
+ | |||
+ | Transform an array of objects into an array of strings: | ||
+ | |||
+ | <code javascript> | ||
+ | const courses = [ | ||
+ | { name: ' | ||
+ | { name: ' | ||
+ | { name: ' | ||
+ | { name: ' | ||
+ | ]; | ||
+ | |||
+ | const coursesAsArray = courses.map(entry => entry.name); | ||
+ | console.table(coursesAsArray); | ||
+ | </ |
java-script/map-method.1691759641.txt.gz · Last modified: 2023/08/11 16:14 by odefta