We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b647f3a commit 6cdb275Copy full SHA for 6cdb275
Sprint-1/refactor/includes.js
@@ -1,13 +1,23 @@
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
- }
+// function includes(list, target) {
+// for (let index = 0; index < list.length; index++) {
+// const element = list[index];
+// if (element === target) {
+// return true;
+// }
9
10
+// return false;
11
12
+
13
14
+function includes(list,target){
15
+ for (let value of list) {
16
+ if (value === target) {
17
+ return true;
18
}
- return false;
19
20
+ return false;
21
+};
22
23
module.exports = includes;
0 commit comments