0

I stumbled upon some strange JS feature(?) or behavior by accident and I cannot explain or google it.

function foo([a]) { alert(a); };
foo('Those brakets will make me use a string, but only uses the first char');

function foo({a}) { alert(typeof a); };
foo('This one will make "a" always be undefined');

And there might be more. Does this behavior have a name? Or can anyone explain it?

Marco Alka
  • 894
  • 1
  • 12
  • 29

0 Answers0