Conversation
| @@ -1,5 +1,5 @@ | |||
| const booleanToWord = (boolean) => { | |||
|
|
|||
| return (boolean ? 'Yes' : 'No'); | |||
There was a problem hiding this comment.
Really good use of a ternary operator. Concise and effective.
| if (number % 3 === 0) { | ||
| return 'Fizz' | ||
| } | ||
|
|
There was a problem hiding this comment.
Instead of 3 separate if statements, one else if or switch statement would have been more concise here. Code works though and passes the tests.
|
|
||
| } | ||
| const numberToReversedDigits = (number) => | ||
| number.toString().split('').map(Number).reverse(); |
There was a problem hiding this comment.
Very good, concise and effective.
| } newArray.push(24 + ((number - 2) * 4)) | ||
| newArray.push(24 + ((number - 2) * 5)) | ||
| return newArray | ||
| } |
There was a problem hiding this comment.
Although this code passes the tests you wrote, unfortunately it doesn't stand up to any robust or dynamic testing. If the user enters a number you haven't hardcoded in here, the code will fail as will the tests.
| it('returns array of cat, human and dog ages even if less than 3', () => { | ||
| expect(humanCatDogYears(2)).toEqual([2, 24, 24]) | ||
| }); | ||
| }); |
There was a problem hiding this comment.
These tests are fine and work accordingly but should the user enter a 0, negative number, a 3 or upwards, the code that passes these tests will fail. Ensure your tests have more robust coverage.
|
|
||
| const reachDestination = (distance, speed) => { | ||
| return `I should be there in ${Math.round((distance / speed) * 2) / 2} hours`; | ||
| } |
There was a problem hiding this comment.
Code passes the test that was written but could be more accurate.
|
|
||
| expect(reachDestination(44, 10)).toEqual('I should be there in 4.5 hours') | ||
| }); | ||
| }); |
There was a problem hiding this comment.
More robust testing needed for edge cases.
| } | ||
|
|
||
| module.exports = joinNames; | ||
| module.exports = joinNames No newline at end of file |
There was a problem hiding this comment.
Works well. Effective and clean code.
| return employees[i].role; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Really concise and effective code. Well done.
No description provided.