London| 26-ITP-May | Martin Mwaka | Sprint 3 | Practice tdd#1431
London| 26-ITP-May | Martin Mwaka | Sprint 3 | Practice tdd#1431Temceo wants to merge 9 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work, I see one place you might be able to clean up the count implementation
| @@ -1,5 +1,10 @@ | |||
| function countChar(stringOfCharacters, findCharacter) { | |||
| return 5 | |||
| if (stringOfCharacters.length === 0 || findCharacter.length === 0) return 0; | |||
There was a problem hiding this comment.
What does this if condition do in this function?
There was a problem hiding this comment.
This condition returns 0 if either the string or the character are empty. I have updated the code to make it more readable
There was a problem hiding this comment.
The first line is not needed as count is initialised to zero later in the function. If count is not incremented it will return zero. I have now removed it.
LonMcGregor
left a comment
There was a problem hiding this comment.
This is a bit more readable. I am still wondering if this if conditional needs to be there. Have you tried running the function without the if check?
LonMcGregor
left a comment
There was a problem hiding this comment.
Good fix - it's always good to look out for possible "dead code" to simplify things
Self checklist
Changelist
Completed Test Driven Development tasks