Skip to content

Commit 0940103

Browse files
committed
Refactor to use for of loop
1 parent ebbad7e commit 0940103

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Sprint-1/refactor/includes.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
// Refactor the implementation of includes to use a for...of loop
2-
31
function includes(list, target) {
4-
for (let index = 0; index < list.length; index++) {
5-
const element = list[index];
6-
if (element === target) {
7-
return true;
8-
}
2+
for (const item of list) {
3+
if (item === target) return true;
94
}
105
return false;
116
}

0 commit comments

Comments
 (0)