Skip to content

Instantly share code, notes, and snippets.

@niktariy
Created September 22, 2019 15:49
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 niktariy/614e4f267a2f88869dc5d9d6dcf8e255 to your computer and use it in GitHub Desktop.
Save niktariy/614e4f267a2f88869dc5d9d6dcf8e255 to your computer and use it in GitHub Desktop.
Behavior of duplicated named parameters in non-strict mode
function logParams (first, second, first) {
console.log(first, second);
}
// first => 'Hello'
// second => 'World'
// first => '!!!'
logParams('Hello', 'World', '!!!'); // "!!!" "World"
// first => { o: 3 }
// second => [ 1, 2, 3 ]
// first => undefined
logParams({ o: 3 }, [ 1, 2, 3 ]); // undefined [1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment