There was an error while loading. Please reload this page.
1 parent b51bc9d commit 5e42552Copy full SHA for 5e42552
1 file changed
Sprint-1/refactor/includes.js
@@ -1,13 +1,21 @@
1
// Refactor the implementation of includes to use a for...of loop
2
3
+// 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
+// }
9
10
+// return false;
11
12
+
13
function includes(list, target) {
- for (let index = 0; index < list.length; index++) {
- const element = list[index];
14
+ for (element of list) {
15
if (element === target) {
16
return true;
17
}
18
19
return false;
20
-
21
module.exports = includes;
0 commit comments