mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 18:11:38 +00:00
Merge pull request #1376 from kalebdavis/master
Fix indentation to make compiled JS more readable
This commit is contained in:
commit
d115a86ac8
@ -54,19 +54,19 @@ math =
|
|||||||
square: square
|
square: square
|
||||||
cube: (x) -> x * square x
|
cube: (x) -> x * square x
|
||||||
#=> var math = {
|
#=> var math = {
|
||||||
# "root": Math.sqrt,
|
# "root": Math.sqrt,
|
||||||
# "square": square,
|
# "square": square,
|
||||||
# "cube": function(x) { return x * square(x); }
|
# "cube": function(x) { return x * square(x); }
|
||||||
#}
|
# };
|
||||||
|
|
||||||
# Splats:
|
# Splats:
|
||||||
race = (winner, runners...) ->
|
race = (winner, runners...) ->
|
||||||
print winner, runners
|
print winner, runners
|
||||||
#=>race = function() {
|
#=>race = function() {
|
||||||
# var runners, winner;
|
# var runners, winner;
|
||||||
# winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
# winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
||||||
# return print(winner, runners);
|
# return print(winner, runners);
|
||||||
#};
|
# };
|
||||||
|
|
||||||
# Existence:
|
# Existence:
|
||||||
alert "I knew it!" if elvis?
|
alert "I knew it!" if elvis?
|
||||||
@ -75,14 +75,14 @@ alert "I knew it!" if elvis?
|
|||||||
# Array comprehensions:
|
# Array comprehensions:
|
||||||
cubes = (math.cube num for num in list)
|
cubes = (math.cube num for num in list)
|
||||||
#=>cubes = (function() {
|
#=>cubes = (function() {
|
||||||
# var _i, _len, _results;
|
# var _i, _len, _results;
|
||||||
# _results = [];
|
# _results = [];
|
||||||
# for (_i = 0, _len = list.length; _i < _len; _i++) {
|
# for (_i = 0, _len = list.length; _i < _len; _i++) {
|
||||||
# num = list[_i];
|
# num = list[_i];
|
||||||
# _results.push(math.cube(num));
|
# _results.push(math.cube(num));
|
||||||
# }
|
# }
|
||||||
# return _results;
|
# return _results;
|
||||||
# })();
|
# })();
|
||||||
|
|
||||||
foods = ['broccoli', 'spinach', 'chocolate']
|
foods = ['broccoli', 'spinach', 'chocolate']
|
||||||
eat food for food in foods when food isnt 'chocolate'
|
eat food for food in foods when food isnt 'chocolate'
|
||||||
|
Loading…
Reference in New Issue
Block a user