each

今更ながらjQueryを勉強。
第1回 jQueryライブラリ(1~171行目):jquery.jsを読み解く|gihyo.jp … 技術評論社

# rubyのeach_with_indexみたいなのかと思ってこんな風にしてみた
> var a = $([1, 2, 3, 4]);
> a.each(function(i, v) {
  console.log("index: " + i + " => " + v)});
index: 0 => 1
index: 1 => 2
index: 2 => 3
index: 3 => 4
# でもthisでよかった
> a.each(function(i) {
  console.log("index: " + i + " => " + this)});
index: 0 => 1
index: 1 => 2
index: 2 => 3
index: 3 => 4