Last active
August 28, 2016 18:38
-
-
Save gggauravgandhi/654afc917173e67c5cdf0bb6f33d656f to your computer and use it in GitHub Desktop.
Function / Variable naming in Javascript Stack
This file contains hidden or 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
// type-1 | |
var do_maths_add_two_number = function(val_one, val_two){ /*...*/ }; | |
do_maths_add_two_number(10, 90); // Calling type-1 | |
/// can be re-written as | |
// type-2 | |
var do_maths = function(params){ /*...*/ }; | |
do_maths({ mode : 'add', values[10,90]}); // Calling type-2 | |
// OR | |
do_maths({"add" : [10,90]}); // Calling type-2 | |
/// So longer name can be shorten still keeping its meaning and structure. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment