|
|
|
|
|
by justsomeuser
1213 days ago
|
|
Under "Everything is an Expression": items = (() => {
const results = [];
for (const item of items) {
if (item.length) {
results.push(item.toUpperCase());
} else {
results.push("<empty>");
}
}
return results;
})();
Seems like they are purposely making the JS version extra long. It could be: items = items.map(x => x.length > 0 ? x.toUpperCase() : `<empty>`)
Edit: Just realised the code on the right is the compiled code, not the "equivalent hand written JS". |
|