javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Update collatz.js

Open Rudxain opened this issue 3 years ago • 1 comments

Strict mode, better docs, refactoring, support for negatives, protection against infinite loops, etc...

I am creating a pull request for...

  • [ ] New algorithm
  • [x] Update to an algorithm
  • [x] Fix an error
  • [x] Other -...

"Collatz conjecture" is not a sequence. The standard-de-facto name convention is "Hailstone sequence", that's why I edited the comments.

I added JSdoc to explicitly specify the expected type of n, to reduce the likelihood of misuse of that function

Rudxain avatar Sep 16 '22 07:09 Rudxain

I haven't tested it yet, that's why it's a draft. Please be patient, I'll test later

Rudxain avatar Sep 16 '22 07:09 Rudxain