Created
November 30, 2022 18:56
-
-
Save appoll/5faa849a65bd54651e6786bdfbf3336b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// // Add the string "passed" to every element in the array below: | |
let students = ["Sebastian", "Oliver", "Samuel", "Hugo", "Lily", "Vasilis"] | |
students.forEach((value, index, array) => { | |
console.log(value); | |
array[index] += " passed"; | |
}) | |
console.log(students); | |
// Add the length of each name to each string element in the array below: | |
// e.g. "Paul 4" "Sebastian 9" | |
// // Add 10 % to each price in the folowing array, using foreach and arrow function | |
// let prices = [10, 20, 30, 40, 50] | |
// prices.forEach((value, index, array) => { | |
// console.log(value); | |
// array[index] += "..."; | |
// }) | |
// console.log(prices); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment