Skip to content

Instantly share code, notes, and snippets.

@zythum
Created January 17, 2014 17:13
Show Gist options
  • Save zythum/8477316 to your computer and use it in GitHub Desktop.
Save zythum/8477316 to your computer and use it in GitHub Desktop.
#i用户统计点击了多少次页面, 产经理最喜欢统计数据了
i = 0;
document.body.addEventListener 'click', ()-> console.log ++i
# 很简单的数值交换函数 o.prop1 <=> o.prop2
_switch = (o, prop1, prop2)->
#`var i`
i = o[prop2]
o[prop2] = o[prop1]
o[prop1] = i
o;
a = p1: '1', p2: '2'
_switch a, 'p1', 'p2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment