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 4950064 commit 70627a0Copy full SHA for 70627a0
1 file changed
Sprint-1/refactor/includes.js
@@ -1,8 +1,7 @@
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];
+ for (const element of list) {
6
if (element === target) {
7
return true;
8
}
@@ -11,3 +10,10 @@ function includes(list, target) {
11
10
12
13
module.exports = includes;
+
14
+// const array = ["a", "b", "c"];
15
16
+// for (const element of array) {
17
+// console.log(element);
18
+// } for (variable of iterable) statement
19
0 commit comments