Last active
August 8, 2020 04:43
-
-
Save itaditya/de2f01d2a3830b235b3f16d713b724d4 to your computer and use it in GitHub Desktop.
(Blog) Why named arguments are better than positional arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementation | |
function myCustomParseInt(objArgs) { | |
return parseInt(objArgs.item, objArgs.radix); | |
} | |
// Usage | |
const num = myCustomParseInt({ item: '100', radix: 10 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry, should've looked first...
https://jsperf.com/object-vs-positional-args
Surprisingly, nearly no difference on chrome mobile