7 ms·
If you use a sufficiently smart JS optimizer, it will optimize the object creation and destructuring away. For example, Google Closure Compiler can take f
by cgdub 5y ago
If you use a sufficiently smart JS optimizer, it will optimize the object creation and destructuring away.
For example, Google Closure Compiler can take
function hello({name}) {
alert('Hello, ' + name);
}
hello({name: 'World'});
and compile it into
alert("Hello, World");
- cnasc 5y agoAn alternate universe where Closure Compiler became the preferred way to build JS projects would be interesting. Clojurescript made that choice, though in retrospect it kind of seems like they backed the wrong horse.