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 0467d03 commit a9a5914Copy full SHA for a9a5914
Sprint-1/refactor/includes.js
@@ -1,12 +1,13 @@
1
// Refactor the implementation of includes to use a for...of loop
2
3
+// This function checks if a value is in a list. It returns true if found, otherwise false.
4
function includes(list, target) {
- 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
}
9
10
+
11
return false;
12
13
0 commit comments