Skip to content

Commit e0ff101

Browse files
committed
refactor and stretch exercise completed.
1 parent 45812d4 commit e0ff101

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Sprint-1/refactor/includes.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Refactor the implementation of includes to use a for...of loop
22

33
function includes(list, target) {
4-
for (let index = 0; index < list.length; index++) {
5-
const element = list[index];
4+
for (const element of list) {
65
if (element === target) {
76
return true;
87
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function sum(list) {
2+
return list.reduce((a, b) => a + b, 0);
3+
}

0 commit comments

Comments
 (0)