Skip to content

review#25

Open
ersel wants to merge 3 commits intoCommandShiftHQ:mainfrom
annabalquin:master
Open

review#25
ersel wants to merge 3 commits intoCommandShiftHQ:mainfrom
annabalquin:master

Conversation

@ersel
Copy link

@ersel ersel commented Nov 14, 2020

No description provided.

@@ -1,3 +1,18 @@
const fizzBuzz = number => {};
const fizzBuzz = number => {
Copy link
Author

@ersel ersel Nov 14, 2020

Choose a reason for hiding this comment

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

I try to avoid chaining ternaries as they get harder to read...

you could have considered if, or switch here.

// less verbose, more chained

const numberToReversedDigitsChain = number => {
return String(number).split("").map(char => Number(char)).reverse();
Copy link
Author

Choose a reason for hiding this comment

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

I would have done it like this, using chained...

@@ -1,3 +1,22 @@
const humanCatDogYears = number => {};
const calculateAnimalYears = (animal, number) => {
let factor = animal === "dog" ? 5 : animal === "cat" ? 4 : console.error("animal not recognised");
Copy link
Author

Choose a reason for hiding this comment

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

again, don't chain ternaries like this

const joinNames = namesObjArray => {
const names = namesObjArray.map((person, index) => {

if (index === namesObjArray.length - 1){
Copy link
Author

Choose a reason for hiding this comment

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

nice solution

Copy link
Author

@ersel ersel left a comment

Choose a reason for hiding this comment

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

just minor comments, nice clear solutions and descriptive variable names 👌

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