Skip to content

Kate diy-kata#19

Open
mmarla wants to merge 1 commit intoCommandShiftHQ:mainfrom
Kate24676:master
Open

Kate diy-kata#19
mmarla wants to merge 1 commit intoCommandShiftHQ:mainfrom
Kate24676:master

Conversation

@mmarla
Copy link

@mmarla mmarla commented Jun 27, 2019

No description provided.

Copy link
Author

@mmarla mmarla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Kate 👋

Well done in completing this track 🎈You have good solutions to the katas and your code tends to be nicely succinct.

A couple of comments:

  • we try to make our code readable and maintainable, and spacing, organization, and variable naming matter.
  • fizzbuzz is 1/3 implemented, if you'd like to pair program the remaining of it I'd be happy to do so with you. This kata is one that many companies use for tech tests, believe it or not!

@@ -1,5 +1,5 @@
const reachDestination = (distance, speed) => {

const reachDestination = (d, s) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good and succinct implementation. Ideally, we call our variables more than single vowels, like distance instead of d and speed intead of s.

@@ -1,5 +1,6 @@
const joinNames = (namesObj) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 A comment on the variable naming, x makes sense in a situation where we're talking about spacial coordinates, but on an array of names not as much. Maybe we can use name instead?

@@ -1,5 +1,5 @@
const numberToReversedDigits = (number) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, good use of string methods, nicely concatenated too 👌

@@ -1,5 +1,28 @@
const humanCatDogYears = (number) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on this one. Ideally, we should try to make sure our code is well structured (indentation, spacing and variables well named).

@@ -1,5 +1,28 @@
const humanCatDogYears = (number) => {
let tmp = number;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to assign number to temp as we can use number throughout the algorithm.

@@ -1,5 +1,9 @@
const getEmployerRole = (employeeName, employees) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're very close in nailing the implementation of this one:

  • first error is employee is not defined and that's because it needs to be declared like for (let employee of employees) 💡 notice the let
  • then our comparison in the if statement: employee is the whole object that includes name and role, so we might want to write it like if (employee.name === employeeName)
  • finally, we want to return the employee role, and we can do that by return employee.role

@@ -1,5 +1,9 @@
const booleanToWord = (boolean) => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd like something some succinct try a ternary operator like return Boolean(boolean) ? 'Yes' : 'No'

}, {
name: 'Maggie'
}];
expect(joinNames(data)).toEqual('Bart, Lisa & Maggie');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good choice of names :)

const getEmployerRole = require('../src/kata7.getEmployerRole');

describe('getEmployerRole', () => {
const employees = [{
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this test, it would have been perfect to have at least another element in the array, to make sure that our function is actually choosing one employee over another.

@@ -1,19 +1,21 @@
const { fizzBuzz } = require('../src');
import { fizzBuzz } from '../src/kata1.fizzBuzz';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we're working in node, the import {} from "" syntax doesn't work. We need to use the require syntax here as we do in all the other tests. This is why our tests for fizzbuzz don't run at all atm with the error TypeError: (0 , _kata.fizzBuzz) is not a function

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.

2 participants