Add Length Conversion#1390
Add Length Conversion#1390raklaptudirm merged 1 commit intoTheAlgorithms:masterfrom 0APOCALYPSE0:master
Conversation
appgurueu
left a comment
There was a problem hiding this comment.
I don't think this is interesting enough algorithmically yet; the code also suffers from unnecessary code duplication: You've effectively hardcoded the cartesian product of {mile, kilometer, meter, centimeter, feet, yard, inch} with itself (and excepting self-to-self, of course).
I think you should change your function to be something like function LengthConversion(length, fromUnit, toUnit) where fromUnit and toUnit are standard abbreviations like km for kilometre or similar. Then you should use a lookup dict which maps these to meters. The calculation then becomes length * meters[fromUnit] / meters[toUnit], and you get away with a fraction of the code.
|
@appgurueu I have updated. Could you please review it now? |
Update Length Conversion resolved comments
Feature
I have added Algorithms for Length Conversion.
Issue #1391
Describe your change:
Checklist:
Example:
UserProfile.jsis allowed butuserprofile.js,Userprofile.js,user-Profile.js,userProfile.jsare notFixes: #{$ISSUE_NO}.