Yet another great feature heavily inspired from CoffeeScript (and tastefully expanded upon). Well done!
The surprising thing for me is that destructuring _almost_ allows defining default values for function arguments.
The surprising thing for me is that destructuring _almost_ allows defining default values for function arguments.
Javascript 1.7 was introduced in Firefox 2, in October 2006.
> I'd bet it wasn't a novel invention back then.
Indeed, ML featured destructuring assignment (which it called "patterns") of tuples and records back in the 70s.
"CoffeeScript programmers"? Is that a thing?
Glad to see some of the good bits making their way back in. The number of times I've had to do
function(firstParam, secondParam, thirdParam) {
if (firstParam.hasOwnProperty('firstParam') {
var argumentDict = firstParam;
firstParam = argumentDict['firstParam'];
secondParam = argumentDict['secondParam'];
thirdParam = argumentDict['thirdParam'];
}
firstParam = firstParam || "default value";
...
is sickening.1) https://mail.mozilla.org/pipermail/es-discuss/2008-August/00...
(Disclaimer: I work for MS).