|
Advertisement
|
"ruby javascript".split(" ").map (
function (ele) {
return ele.toUpperCase();
}
)
I know, that easily looks like some Ruby code. But it’s goddamn JavaScript.
Wait, there’s more. Some day, not so far away, I must guess, we could soon be doing something like this:
["I", "love", "objects"].forEach (
function (element, index, array) {
print element;
}
)
Basically, the cool folks at Mozilla have extended the JavaScript specifications, specifically adding a buncha cool stuff to the Array object.
You sure do see where this has probably come from, don’t you? Now if only it’d behave like real Ruby blocks.
(Discovered via Slashdot.)
Read: Mozilla Kinda Discovers Rubyland