-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #2319
base: master
Are you sure you want to change the base?
Develop #2319
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,26 @@ | |
|
||
function makeRobotAccountant() { | ||
// write code here | ||
// random comment cuz i forgot to switch branch and need to make changes :P | ||
let counter = 0; | ||
|
||
function getSum(a) { | ||
function bullshitNesting(b) { | ||
if (counter > 2 && counter % 2 === 1) { | ||
counter++; | ||
|
||
return `Bzzz... Error!`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would wrap it in a variable, e.g. error, then return error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, since we are not doing operations on this variable, it does not change or appear in different places, it's not a part of a list of options (like in stateful clones) we don't need to wrap it in a variable. |
||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you are using
|
||
counter++; | ||
|
||
return a + b; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here I would also wrap in a variable sum and return the sum There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
} | ||
} | ||
|
||
return bullshitNesting; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just use arrow functions |
||
|
||
return getSum; | ||
} | ||
|
||
module.exports = makeRobotAccountant; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move
counter++
outside of if statements