-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
add more functions to DecimalToBinary.js file from Conversions directory #1074
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
add more functions to DecimalToBinary.js file from Conversions directory #1074
Conversation
This pull request introduces 1 alert when merging 322a67c into 1a089cc - view on LGTM.com
new alerts:
- 1 for Unused variable, import, function or class
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.
Overall questionable: Second method just lets JS builtins do the job, third one has poor code quality and is mostly a duplicate of the first one. Leaning towards rejecting this - it probably has to be redone pretty much entirely, if it should be redone at all.
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.
This feels like cheating: The purpose of this repo is to demonstrate how this could be implemented without relying on libraries (including the standard library). Perhaps note the existence of a suitable stdlib func in a comment?
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.
Please convert to proper tests instead of removing the trailing newline (?)
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.
Unused variable.
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.
Looks like a hacky reimplementation of decimalToBinary
to me, except instead of using an array to store the digits this uses a base 10 number which may then be stringified in base 10 to produce the desired binary number.
The parseInt
hack to achieve floor division rather than using dec >>= 1
is a clear downgrade. You could consider Math.floor(dec / 2)
for readability, but relying on parseInt
to perform flooring is hacky IMO.
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.
You could use +=
here.
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.
and *=
here
I suggest marking this pr as invalid.
Uh oh!
There was an error while loading. Please reload this page.
Open in Gitpod know more
Describe your change:
Checklist:
Example:
UserProfile.js
is allowed butuserprofile.js
,Userprofile.js
,user-Profile.js
,userProfile.js
are notFixes: #{$ISSUE_NO}
.