java-script:map-method
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| java-script:map-method [2023/08/11 13:14] – ↷ Page moved from java-script:string:map-method to java-script:map-method odefta | java-script:map-method [2025/01/02 18:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| 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: (external edit)
