File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Sprint-3/4-stretch-investigate Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ console.log(find("code your future", "z")); // Should output -1 since 'z' is not
2525
2626/*
2727Explanation:
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.
2930b) The 'if' statement checks whether the current character (str[index]) matches the character we're searching for.
3031c) '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
You can’t perform that action at this time.
0 commit comments