Skip to content

Commit 872ddf0

Browse files
author
JorvanW
committed
modified code on includes.js to use a for...of loop
1 parent e3befbb commit 872ddf0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎Sprint-1/refactor/includes.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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
}
98
}
109
return false;
1110
}
1211

12+
1313
module.exports = includes;

0 commit comments

Comments
 (0)