Skip to content

Conversation

@GomuGilad6
Copy link

If the for loop finishes without returning false, it will always return true.
Both strings have the same length at this point (if not, the function will return false at its beginning).
So if a character exists in one string and not the other, count will be undefined, and the function will return false.
The function will always return true if it finishes the for loop as the map size will be 0, so might as well return true (could be confusing as to why you have to return the map size).

If the for loop finishes without returning false, it will always return true.
Both strings have the same length at this point (if not, the function will return false at its beginning).
So if a character exists in one string and not the other, count will be undefined, and the function will return false.
The function will always return true if it finishes the for loop as the map size will be 0, so might as well return true (could be confusing as to why you have to return the map size).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant