Skip to content

Commit a9a5914

Browse files
committed
Refactored the implementation of Includes function and passed the given tests.
1 parent 0467d03 commit a9a5914

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sprint-1/refactor/includes.js

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

3+
// This function checks if a value is in a list. It returns true if found, otherwise false.
34
function includes(list, target) {
4-
for (let index = 0; index < list.length; index++) {
5-
const element = list[index];
5+
for (const element of list) {
66
if (element === target) {
77
return true;
88
}
99
}
10+
1011
return false;
1112
}
1213

0 commit comments

Comments
 (0)