by callahad · 10y ago · 0 comments
For example, default arguments are purely syntactic sugar for `if (arg === undefined) { arg = x; }` in the first line of a function. Still, I'd much rather write ES6's declarative `function foo(arg=x) { }` syntax rather than imperatively implement it in ES5 each time I need it.
Need is a strong word.
If I need that pattern, I'd rather write it declaratively than imperatively. :)