Skip to content

Commit 5edb209

Browse files
committed
Added tests and implemented solution for the refactor section - includes.js
1 parent 821e75a commit 5edb209

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sprint-1/refactor/includes.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +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) {
4+
for (const el of list) {
5+
if (el === target) {
76
return true;
87
}
98
}

0 commit comments

Comments
 (0)