Skip to content

Instantly share code, notes, and snippets.

@gggauravgandhi
Last active August 28, 2016 18:38
Show Gist options
  • Save gggauravgandhi/654afc917173e67c5cdf0bb6f33d656f to your computer and use it in GitHub Desktop.
Save gggauravgandhi/654afc917173e67c5cdf0bb6f33d656f to your computer and use it in GitHub Desktop.
Function / Variable naming in Javascript Stack
// 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