Skip to content

Commit

Permalink
find.js questions answered
Browse files Browse the repository at this point in the history
  • Loading branch information
PERicci committed Nov 29, 2023
1 parent c21815a commit f72734e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions week-4/investigate/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ console.log(find("code your future", "z"));
// Pay particular attention to the following:

// a) How the index variable updates during the call to find
// Increment 1 when reading index++, when the if statement returns false.
// b) What is the if statement used to check
// The if statement checks, for each character in str, if char is equals to the respective character from str.
// c) Why is index++ being used?
// To progress the loop, going forward one str's character each loop and checking it using the if statement.
// d) What is the condition index < str.length used for?
// To limit the loop cycles to the amount of characters in str. The while statement will stop when index reach the same value than the str's length.

0 comments on commit f72734e

Please sign in to comment.