Skip to content

Instantly share code, notes, and snippets.

@vhf
Created November 1, 2015 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vhf/a884c556a70bdcf21fbc to your computer and use it in GitHub Desktop.
Save vhf/a884c556a70bdcf21fbc to your computer and use it in GitHub Desktop.
function reassignedDefinedParameters(x) {
x = x < 0 ? x : -x; // reassign default parameter x
var y = arguments[1]; // mention arguments. Actually use it.
x = x + y; // again
return x + y; // actually use both
}
reassignedDefinedParameters(1, 1);
reassignedDefinedParameters(1, 1);
/*
compiling method 0x71... <JS Function reassignedDefinedParameters (SharedFunctionInfo 0x32...)> using Crankshaft]
[optimizing 0x71... <JS Function reassignedDefinedParameters (SharedFunctionInfo 0x32...)> - took 0.044, 0.089, 0.024 ms]
reassignedDefinedParameters is optimized
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment