Skip to content

Commit d2c79da

Browse files
committed
refactor includes to use for...of loop
1 parent 4213a22 commit d2c79da

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎Sprint-1/refactor/includes.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
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) {
7-
return true;
8-
}
4+
for (const element of list) {
5+
if (element === target) return true;
96
}
107
return false;
118
}

0 commit comments

Comments
 (0)