4 ms·
Javascript isn't complicated but it does have some ugly boiler-plate. I would love to see C# style lambda's in Javascript. C# style: var item_names = $( "li.me
by KeithMajhor 16y ago
Javascript isn't complicated but it does have some ugly boiler-plate. I would love to see C# style lambda's in Javascript.
C# style: var item_names = $( "li.menu_item span" ).map( x => x.innerHTML )
JS style: var item_names = $( "li.menu_item span" ).map( function( x ) { return x.innerHTML } )
- Skofoo 16y agoCoffeeScript has C#-esque lambdas. item_names = $("li.menu_item span").map (x) -> x.innerHTML
- silverlake 16y agoyeah, but the parser is messed up because it is whitespace sensitive. This would fail: compose (x)-> f(x) (y)-> g(y).
- lhorie 16y agojavascript 1.8: $("li.menu_item span").map(function(x) x.innerHTML) for that particular exaple, you could also steal pluck() from Prototype.js: $("li.menu_item span").pluck("innerHTML")