The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
The Javascript-Ruby Connection Slims

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
The Javascript-Ruby Connection Slims Posted: Aug 29, 2005 9:49 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: The Javascript-Ruby Connection Slims
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

Yeah, Ruby and Javascript have a close proximity—flgr once gave us proof. MenTaL spotted a list of additions to Javascript arrays, which reeks of the Ruby Way.

Of special note is the addition of forEach, but just look how valuable the Ruby equivalents of these methods have become to us:

JS Ruby
indexOf index
lastIndexOf rindex
some any?
every all?
filter find_all
forEach each
map map

Interesting. I’m reading here and each of the iterators sends three parameters to the “block”. The value, the current index and the array itself.

 var aNumbers = [4, 2, 6, 9];
 var aTimesTwoNumbers = aNumbers.map(function (v, i, ary) {
   return v * 2;
 });

It’s that index value. We’ve never known where to put it. I believe in Javascript you can safely omit parameters you’re not using. (via webref.)

Read: The Javascript-Ruby Connection Slims

Topic: Another gadget for the shopping list... Previous Topic   Next Topic Topic: Rails to get native tagging support?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use