From c1f0bc3eccd1ec58fd36f4db839666d35cd25202 Mon Sep 17 00:00:00 2001 From: Jeff Su Date: Thu, 10 Mar 2011 18:18:50 +0800 Subject: [PATCH] using enumerables in demo --- index.haml | 8 ++++++-- index.html | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/index.haml b/index.haml index 68b117e..70803bc 100644 --- a/index.haml +++ b/index.haml @@ -30,6 +30,8 @@ var foo = new Foo(); alert(foo.world()); + var arr = [ 1, 2, 3, 4 ]; + alert(js2(arr).reduce(\#{ return $1 + $2 })); %input.run{ :type => 'button', :value => 'Run' } @@ -96,7 +98,9 @@ font-size: 1.2em :javascript - $('.run').click(function () { - eval(js2.render($('.code').val())); + $(function () { + $('.run').click(function () { + eval(js2.render($('.code').val())); + }); }); diff --git a/index.html b/index.html index 7883b6c..5440893 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,10 @@

Try

} var foo = new Foo(); -alert(foo.world()); +alert(foo.world()); + +var arr = [ 1, 2, 3, 4 ]; +alert(js2(arr).reduce(#{ return $1 + $2 }));

Install

@@ -81,8 +84,10 @@

Source