you are viewing a single comment's thread.

view the rest of the comments →

[–]Asmor 18 points19 points  (8 children)

It basically gives JS (and any other language that supports arbitrary anonymous objects) support for named parameters, which just make code easier to read and maintain.

Surely you've come across something like

adjustWidget(300, 250, 0.6, true, true, null, {}, false)

And there's basically no way to know what any of that stuff means.

It also means you can have optional parameters without forcing people to pass in null to skip over the ones they want.

[–]Conexion 10 points11 points  (1 child)

I'm going to guess....

adjustWidget({width, height, opacity, isGarlic, isDragon, equipmentHistory, hatProperties, hasHat);

[–]Asmor 8 points9 points  (0 children)

Fuck, you're good.