20150302随笔

1.对象的查找

document.title = obj[self.today.substring(0, 7)];

不需要以下这么麻烦:

$.each(obj , function(index,val){
    var month = self.today.substring(0,7);
    if(index == month){
    document.title = val;
    }
});

2.each

如果是遍历节点时:

self.pages.each(function(index){

  $(this).css('z-index', self.pageLen+1);

})

如果遍历数组时:

$([1,2,11]).each(function(i,item){

  console.log(item)

})

原文地址:https://www.cnblogs.com/vivijs/p/4309017.html