Skip to content

Conversation

merelymyself
Copy link
Contributor

Welcome to the JavaScript community

Open in Gitpod know more

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

There was previously an unnecessary check for if the number was 0 or 1.
The test was not present previously.
appgurueu
appgurueu previously approved these changes Apr 21, 2022
Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

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

I'd probably prefer a for-loop but this is fine. Thanks for adding tests in particular. @raklaptudirm do we have a guideline on authorship documented as comments in code files? I believe it should be kept only in the Git history and the comment should be removed entirely.

@appgurueu appgurueu added feature Adds a new feature Reviewed labels Apr 21, 2022
@merelymyself merelymyself requested a review from appgurueu April 21, 2022 11:02
@appgurueu
Copy link
Collaborator

standard: Use JavaScript Standard Style (https://standardjs.com/)
standard: Run standard --fix to automatically fix some problems.
/home/runner/work/Javascript/Javascript/Maths/test/WhileLoopFactorial.test.js:3:23: Missing space before function parentheses.

@raklaptudirm space before function parentheses is bad style IMO, can't standard be configured differently?

@raklaptudirm
Copy link
Member

@appgurueu No standard is a style that can't be configured. That is basically the reason we use it, as it is easy of beginners. Imo, as long a consistent style is being maintained the details don't matter.

@raklaptudirm
Copy link
Member

Also, we do not have a guideline for inline author annotations.

@raklaptudirm
Copy link
Member

@merelymyself Do this:

$ npm install standard --global
$ standard --fix

@raklaptudirm raklaptudirm changed the title Optimised "WhileLoopFactorial.js"; Added corresponding test. WhileLoopFactorial: Optimize and add tests Apr 21, 2022
@raklaptudirm raklaptudirm merged commit 9513bcd into TheAlgorithms:master Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants