Skip to content

Commit 28dfefd

Browse files
committed
just to writing a missing bits.
1 parent 276c348 commit 28dfefd

File tree

1 file changed

+4
-2
lines changed
  • Sprint-3/4-stretch-investigate

1 file changed

+4
-2
lines changed

Sprint-3/4-stretch-investigate/find.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ console.log(find("code your future", "z")); // Should output -1 since 'z' is not
2525

2626
/*
2727
Explanation:
28-
a) The 'index' variable starts at 0 and increments by 1 each loop (index++), allowing the function to check each character in the string.
28+
a) The 'index' variable starts at 0 and increments by 1 each loop (index++), allowing the function to
29+
check each character in the string.
2930
b) The 'if' statement checks whether the current character (str[index]) matches the character we're searching for.
3031
c) 'index++' is used to move forward to the next character in the string on each loop iteration.
31-
d) The condition 'index < str.length' ensures the loop only runs while 'index' is a valid position inside the string, preventing errors.
32+
d) The condition 'index < str.length' ensures the loop only runs while 'index' is a valid position inside the string,
33+
preventing errors.
3234
*/
3335

0 commit comments

Comments
 (0)