Skip to content

Commit 34d7135

Browse files
feat: add updated code of arrayMethods.js file
1 parent 8c34283 commit 34d7135

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

part4 (Arrays and Loops)/02_arrayMethods.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const newarr13 = arr13.slice(1, 3); // [2, 3]
8585
const newarr20 = arr13.slice(1); // [2, 3, 4, 5]
8686
console.log(newarr13);
8787

88-
// Array splice Method splice(index, howmany, "new value", Delete) changes in the exesting array
88+
// Array splice Method splice(startIndex, deleteCount, "new value", item1, item2) changes in the exesting array
8989
const arr14 = [1, 2, 3, 4, 5];
9090
arr14.splice(2, 0, 6, 7);
9191
arr14.splice(2, 1, 8, 9);
@@ -106,7 +106,6 @@ const prices = [4, 8, 9, 10, 12];
106106
const newPrices = prices.map((price, i, arr) => {
107107
return price * 0.5;
108108
})
109-
110109
console.log(newPrices);
111110

112111

@@ -223,15 +222,3 @@ const findProducts = myProducts.find((elem) => {
223222
})
224223

225224
console.log(findProducts);
226-
227-
228-
229-
// NOTE: Final summary Table for (find, filter, reduce, forEach, map)
230-
/*
231-
Method Creates a New Array? Returns a Single Value? Original Array Modified?
232-
.map() ✅ Yes ✅ Yes (returns a new array) ❌ No
233-
.filter() ✅ Yes ✅ Yes (returns a new array) ❌ No
234-
.reduce() ❌ No ✅ Yes (returns a single value) ❌ No
235-
.find() ❌ No ✅ Yes (returns a single element) ❌ No
236-
.forEach() ❌ No ❌ No (returns undefined) ✅ Yes (can modify original array)
237-
*/

0 commit comments

Comments
 (0)