Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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