Skip to content

Commit 6835ffa

Browse files
committed
for...of refactor
1 parent 1239706 commit 6835ffa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Sprint-1/refactor/includes.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
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];
6-
if (element === target) {
4+
for(let element of list) {
5+
if (element === target)
76
return true;
87
}
9-
}
108
return false;
119
}
1210

0 commit comments

Comments
 (0)