Skip to content

Instantly share code, notes, and snippets.

@jkvim
Last active January 16, 2017 15:14
Show Gist options
  • Save jkvim/3cab345e8a6a5674378b26ea0abf0615 to your computer and use it in GitHub Desktop.
Save jkvim/3cab345e8a6a5674378b26ea0abf0615 to your computer and use it in GitHub Desktop.
Duplicate Function Signature and Variable in JavaScript
// SyntaxError: foo has alreay been declared
const foo = (a, b) => {
console.log(a, b);
};
const foo = (a) => {
console.log(a);
};
foo(10, 100);
foo(200);
// No Error Throw, second one overwrite first one
// output: 10
function bar(a, b) {
console.log(a, b);
}
function bar(a) {
console.log(a);
}
bar(10, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment