Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let's Have a Cup of CoffeeScript

Let's Have a Cup of CoffeeScript

A run through a lot of features CoffeeScript offers to ease your JavaScript development.

Avatar for Nicolás Sanguinetti

Nicolás Sanguinetti

September 26, 2011
Tweet

More Decks by Nicolás Sanguinetti

Other Decks in Programming

Transcript

  1. me = { name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26,

    likesWorkingOn: [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: { name: “Cubox”, url: “http://cuboxsa.com” } }
  2. me = { name: “Nicolás”, location: “Montevideo, Uruguay age: 26,

    likesWorkingOn: [“Ruby”, “Java twitter: “@godfoca”, github: “http://github.com/foc url: “http://nicolassanguinett company: { name: “Cubox”, url: “http://cuboxsa.com”
  3. me = { name: “Nicolás”, location: “Montevid age: 26, likesWorkingOn:

    [“R twitter: “@godfoca” github: “http://git
  4. me = { name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26,

    likesWorkingOn: [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: { name: “Cubox”, url: “http://cuboxsa.com” } }
  5. me = { name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26,

    likesWorkingOn: [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: { name: “Cubox”, url: “http://cuboxsa.com” } }
  6. me = name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26, likesWorkingOn:

    [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: name: “Cubox”, url: “http://cuboxsa.com”
  7. me = name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26, likesWorkingOn:

    [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: name: “Cubox”, url: “http://cuboxsa.com”
  8. me = name: “Nicolás”, location: “Montevideo, Uruguay”, age: 26, likesWorkingOn:

    [“Ruby”, “JavaScript”], twitter: “@godfoca”, github: “http://github.com/foca”, url: “http://nicolassanguinetti.info”, company: name: “Cubox”, url: “http://cuboxsa.com”
  9. me = name: “Nicolás” location: “Montevideo, Uruguay” age: 26 likesWorkingOn:

    [“Ruby”, “JavaScript”] twitter: “@godfoca” github: “http://github.com/foca” url: “http://nicolassanguinetti.info” company: name: “Cubox” url: “http://cuboxsa.com”
  10. me = name: “Nicolás” location: “Montevideo, Uruguay” age: 26 likesWorkingOn:

    [“Ruby”, “JavaScript”] twitter: “@godfoca” github: “http://github.com/foca” url: “http://nicolassanguinetti.info” company: name: “Cubox” url: “http://cuboxsa.com”
  11. var square = function(num) { return num * num; }

    var list = [1, 2, 3, 4, 5]; var squares = []; for (var i = 0; i < list.length; i++) { squares.push(square(list[i])); } 1st Cup: A simple comparison
  12. var square = function(num) { return num * num; }

    var list = [1, 2, 3, 4, 5]; var squares = []; for (var i = 0; i < list.length; i++) { squares.push(square(list[i])); } 1st Cup: A simple comparison
  13. var square = function(num) { return num * num; }

    var list = [1, 2, 3, 4, 5]; var squares = []; for (var i = 0; i < list.length; i++) { squares.push(square(list[i])); } 1st Cup: A simple comparison
  14. var square = function(num) { return num * num; }

    var list = [1, 2, 3, 4, 5]; var squares = []; for (var i = 0; i < list.length; i++) { squares.push(square(list[i])); } 1st Cup: A simple comparison
  15. var square = function(num) { return num * num; }

    var list = [1, 2, 3, 4, 5]; var squares = []; for (var i = 0; i < list.length; i++) { squares.push(square(list[i])); } 1st Cup: A simple comparison
  16. square = (num) -> num * num list = [1..5]

    squares = (square n for n in list) 1st Cup: A simple comparison
  17. square = (num) -> num * num list = [1..5]

    squares = (square n for n in list) 1st Cup: A simple comparison
  18. square = (num) -> num * num list = [1..5]

    squares = (square n for n in list) 1st Cup: A simple comparison
  19. square = (num) -> num * num list = [1..5]

    squares = (square n for n in list) 1st Cup: A simple comparison
  20. square = (num) -> num * num list = [1..5]

    squares = (square n for n in list) 1st Cup: A simple comparison
  21. var add = function(x, y) { return x + “

    + “ + y + “ = “ + (x + y); } console.log(add(2, 3)) > 2 + 3 = 5 console.log(add(5, 7)) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  22. var add = function(x, y) { return x + “

    + “ + y + “ = “ + (x + y); } console.log(add(2, 3)) > 2 + 3 = 5 console.log(add(5, 7)) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  23. var add = function(x, y) { return x + “

    + “ + y + “ = “ + (x + y); } console.log(add(2, 3)) > 2 + 3 = 5 console.log(add(5, 7)) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  24. var add = function(x, y) { return x + “

    + “ + y + “ = “ + (x + y); } console.log(add(2, 3)) > 2 + 3 = 5 console.log(add(5, 7)) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  25. var add = function(x, y) { return x + “

    + “ + y + “ = “ + (x + y); } console.log(add(2, 3)) > 2 + 3 = 5 console.log(add(5, 7)) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  26. add = (x, y) -> “#{x} + #{y} = #{x

    + y}” console.log add(2, 3) > 2 + 3 = 5 console.log add(5, 7) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  27. add = (x, y) -> “#{x} + #{y} = #{x

    + y}” console.log add(2, 3) > 2 + 3 = 5 console.log add(5, 7) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  28. add = (x, y) -> “#{x} + #{y} = #{x

    + y}” console.log add(2, 3) > 2 + 3 = 5 console.log add(5, 7) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  29. add = (x, y) -> “#{x} + #{y} = #{x

    + y}” console.log add(2, 3) > 2 + 3 = 5 console.log add(5, 7) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  30. add = (x, y) -> “#{x} + #{y} = #{x

    + y}” console.log add(2, 3) > 2 + 3 = 5 console.log add(5, 7) > 5 + 7 = 12 2nd Cup: The Useless Calculator
  31. languageOfChoice = (lang) -> if lang == “PHP” “Get outta

    here!” else “#{lang} rocks!” Implicit Return 3rd Cup: Your Favorite Language
  32. languageOfChoice = (lang) -> if lang == “PHP” return “Get

    outta here!” else return “#{lang} rocks!” Implicit Return 3rd Cup: Your Favorite Language
  33. languageOfChoice = (lang = “Ruby”) -> “#{lang} rocks!” console.log languageOfChoice(“Lua”)

    > Lua rocks! console.log languageOfChoice() > Ruby rocks! Default Arguments 3rd Cup: Your Favorite Language
  34. languageOfChoice = (lang = “Ruby”) -> “#{lang} rocks!” console.log languageOfChoice

    “Lua” > Lua rocks! Optional Parentheses 3rd Cup: Your Favorite Language
  35. languageOfChoice = (lang = “Ruby”) -> “#{lang} rocks!” console.log languageOfChoice

    “Lua” > Lua rocks! console.log languageOfChoice Optional Parentheses 3rd Cup: Your Favorite Language
  36. languageOfChoice = (lang = “Ruby”) -> “#{lang} rocks!” console.log languageOfChoice

    “Lua” > Lua rocks! console.log languageOfChoice > [Function] Optional Parentheses 3rd Cup: Your Favorite Language
  37. languageOfChoice = (lang = “Ruby”) -> “#{lang} rocks!” console.log languageOfChoice

    “Lua” > Lua rocks! console.log languageOfChoice > [Function] console.log languageOfChoice() > Ruby rocks! Optional Parentheses 3rd Cup: Your Favorite Language
  38. Splats languagesOfChoice = (langs...) -> “I like #{langs.join(“, “)}” languagesOfChoice

    “Ruby”, “JS”, “Python” > I like Ruby, JS, Python 3rd Cup: Your Favorite Language
  39. Splats languagesOfChoice = (best, langs...) -> “I love #{best}, and

    I like #{langs.join(“, “)}” 3rd Cup: Your Favorite Language
  40. Splats languagesOfChoice = (best, langs...) -> “I love #{best}, and

    I like #{langs.join(“, “)}” languagesOfChoice “Ruby”, “JS”, “Python” > I love Ruby, and I like JS, Python 3rd Cup: Your Favorite Language
  41. Splats languagesOfChoice = (langs..., worst) -> “I like #{langs.join(“, “)},

    but I hate #{worst}” 3rd Cup: Your Favorite Language
  42. Splats languagesOfChoice = (langs..., worst) -> “I like #{langs.join(“, “)},

    but I hate #{worst}” languagesOfChoice “Ruby”, “JS”, “PHP” > I like Ruby, JS, but I hate PHP 3rd Cup: Your Favorite Language
  43. list = [“Ruby”, “JS”, “Python”] first_two = list[0..1] first_two #=>

    [“Ruby”, “JS”] 4th Cup: Getting Inside Your Objects Tasty Slices
  44. list = [“Ruby”, “JS”, “Python”] last_two = list[1..-1] last_two #=>

    [“JS”, “Python”] 4th Cup: Getting Inside Your Objects Tasty Slices
  45. list = [“Ruby”, “JS”, “Python”] head = list[0] tail =

    list[1..-1] 4th Cup: Getting Inside Your Objects
  46. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Pattern Matching 4th Cup: Getting Inside Your Objects
  47. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Pattern Pattern Matching 4th Cup: Getting Inside Your Objects
  48. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Values Pattern Matching 4th Cup: Getting Inside Your Objects Pattern
  49. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Values Pattern Matching 4th Cup: Getting Inside Your Objects Variables
  50. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Pattern Matching 4th Cup: Getting Inside Your Objects
  51. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    Pattern Matching 4th Cup: Getting Inside Your Objects
  52. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    head #=> “Ruby” Pattern Matching 4th Cup: Getting Inside Your Objects
  53. list = [“Ruby”, “JS”, “Python”] [head, tail] = [list[0], list[1..-1]]

    head #=> “Ruby” tail #=> [“JS”, “Python”] Pattern Matching 4th Cup: Getting Inside Your Objects
  54. list = [“Ruby”, “JS”, “Python”] [head, tail...] = list head

    #=> “Ruby” Pattern Matching 4th Cup: Getting Inside Your Objects
  55. list = [“Ruby”, “JS”, “Python”] [head, tail...] = list head

    #=> “Ruby” tail #=> [“JS”, “Python”] Pattern Matching 4th Cup: Getting Inside Your Objects
  56. list = [“Ruby”, “JS”, “Python”] [top, rest..., bottom] = list

    Pattern Matching 4th Cup: Getting Inside Your Objects
  57. list = [“Ruby”, “JS”, “Python”] [top, rest..., bottom] = list

    top #=> “Ruby” Pattern Matching 4th Cup: Getting Inside Your Objects
  58. list = [“Ruby”, “JS”, “Python”] [top, rest..., bottom] = list

    top #=> “Ruby” bottom #=> “Python” Pattern Matching 4th Cup: Getting Inside Your Objects
  59. list = [“Ruby”, “JS”, “Python”] [top, rest..., bottom] = list

    top #=> “Ruby” bottom #=> “Python” rest #=> [“JS”] Pattern Matching 4th Cup: Getting Inside Your Objects
  60. list = [“Ruby”, “JS”] [top, rest..., bottom] = list Pattern

    Matching 4th Cup: Getting Inside Your Objects
  61. list = [“Ruby”, “JS”] [top, rest..., bottom] = list top

    #=> “Ruby” Pattern Matching 4th Cup: Getting Inside Your Objects
  62. list = [“Ruby”, “JS”] [top, rest..., bottom] = list top

    #=> “Ruby” bottom #=> “JS” Pattern Matching 4th Cup: Getting Inside Your Objects
  63. list = [“Ruby”, “JS”] [top, rest..., bottom] = list top

    #=> “Ruby” bottom #=> “JS” rest #=> [] Pattern Matching 4th Cup: Getting Inside Your Objects
  64. me = name: “Nicolás” company: “Cubox” name = me.name company

    = me.company Pattern Matching 4th Cup: Getting Inside Your Objects
  65. me = name: “Nicolás” company: “Cubox” { name: name, company:

    company } = me Pattern Matching 4th Cup: Getting Inside Your Objects
  66. me = name: “Nicolás” company: “Cubox” { name: name, company:

    company } = me Pattern Pattern Matching 4th Cup: Getting Inside Your Objects
  67. Pattern Matching 4th Cup: Getting Inside Your Objects me =

    name: “Nicolás” company: “Cubox” { name: name, company: company } = me Variables
  68. me = name: “Nicolás” company: “Cubox” { name: name, company:

    company } = me Values Pattern Matching 4th Cup: Getting Inside Your Objects
  69. me = name: “Nicolás” company: “Cubox” { name: name, company:

    company } = me name #=> “Nicolás” company #=> “Cubox” Pattern Matching 4th Cup: Getting Inside Your Objects
  70. { name, company } = me name #=> “Nicolás” Pattern

    Matching 4th Cup: Getting Inside Your Objects
  71. { name, company } = me name #=> “Nicolás” company

    #=> 26 Pattern Matching 4th Cup: Getting Inside Your Objects
  72. list = [1..10] for item in list doSomethingWith(item) 5th Cup:

    Collecting Collections Iterating over arrays
  73. me = name: “Nicolás”, age: 26 for key, value of

    me console.log “#{key}: #{value}” Iterating over objects 5th Cup: Collecting Collections
  74. me = name: “Nicolás”, age: 26 for key, value of

    me console.log “#{key}: #{value}” Iterating over objects 5th Cup: Collecting Collections
  75. doubles = (n * 2 for n in [1..5]) 5th

    Cup: Collecting Collections Comprehensions
  76. n * 2 for n in [1..5] when n >

    2 Filtering Comprehensions 5th Cup: Collecting Collections
  77. n * 2 for n in [1..5] when n >

    2 Filtering Comprehensions 5th Cup: Collecting Collections
  78. n * 2 for n in [1..5] when n >

    2 for n in [1..5] continue unless n > 2 n * 2 Filtering Comprehensions 5th Cup: Collecting Collections
  79. n * 2 for n in [1..5] when n >

    2 for n in [1..5] continue unless n > 2 n * 2 Filtering Comprehensions 5th Cup: Collecting Collections
  80. User = (id, name) -> this.id = id this.name =

    name this.element = $(“#user-#{this.id}”) 6th Cup: Context, the classy way
  81. Context Accessor 6th Cup: Context, the classy way User =

    (id, name) -> this.id = id this.name = name this.element = $(“#user-#{this.id}”)
  82. Context Accessor 6th Cup: Context, the classy way User =

    (id, name) -> this.id = id this.name = name this.element = $(“#user-#{this.id}”)
  83. Context Accessor 6th Cup: Context, the classy way User =

    (id, name) -> this.id = id this.name = name this.element = $(“#user-#{this.id}”)
  84. Context Accessor 6th Cup: Context, the classy way User =

    (id, name) -> this.id = id this.name = name this.element = $(“#user-#{this.id}”)
  85. User = (id, name) -> @id = id @name =

    name @element = $(“#user-#{@id}”) Context Accessor 6th Cup: Context, the classy way
  86. Property Arguments 6th Cup: Context, the classy way User =

    (id, name) -> @id = id @name = name @element = $(“#user-#{@id}”)
  87. User = (id, name) -> @id = id @name =

    name @element = $(“#user-#{@id}”) Property Arguments 6th Cup: Context, the classy way
  88. Property Arguments 6th Cup: Context, the classy way User =

    (@id, @name) -> @element = $(“#user-#{@id}”)
  89. Property Arguments 6th Cup: Context, the classy way User =

    (@id, @name) -> @element = $(“#user-#{@id}”)
  90. User = (@id, @name) -> @element = $(“#user-#{@id}”) User.prototype.signOut =

    -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  91. User = (@id, @name) -> @element = $(“#user-#{@id}”) User.prototype.signOut =

    -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  92. User = (@id, @name) -> @element = $(“#user-#{@id}”) User.prototype.signOut =

    -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  93. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    -> this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  94. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    -> this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  95. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    -> this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  96. User = (@id, @name) -> @element = $(“#user-#{@id}”) self =

    this $(“a.sign-out”, @element).click -> self.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  97. User = (@id, @name) -> @element = $(“#user-#{@id}”) self =

    this $(“a.sign-out”, @element).click -> self.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  98. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    => this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  99. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    => this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  100. User = (@id, @name) -> @element = $(“#user-#{@id}”) $(“a.sign-out”, @element).click

    => this.signOut() false User.prototype.signOut = -> $.ajax(...) Bound Functions 6th Cup: Context, the classy way
  101. 6th Cup: Context, the classy way Classes class User constructor:

    (@id, @name) -> @element = $(“#user-#{@id}”) signOut: -> ...
  102. 6th Cup: Context, the classy way Classes class User constructor:

    (@id, @name) -> @element = $(“#user-#{@id}”) signOut: -> ...
  103. 6th Cup: Context, the classy way Classes class User constructor:

    (@id, @name) -> @element = $(“#user-#{@id}”) signOut: -> ...
  104. 6th Cup: Context, the classy way Inheritance class User constructor:

    (@id, @name) -> @element = $(“#user-#{@id}”) signOut: -> ...
  105. 6th Cup: Context, the classy way Inheritance class SignedInUser extends

    User ... class SignedOutUser extends User ...
  106. 6th Cup: Context, the classy way super class SignedInUser extends

    User constructor: (args...) -> super args... $(“a.sign-out”, @element).click => this.signOut()
  107. class User constructor: (@id, @name) -> @element = $(“#user-#{@id}”) signOut:

    -> ... 6th Cup: Context, the classy way On variable locality
  108. class window.User constructor: (@id, @name) -> @element = $(“#user-#{@id}”) signOut:

    -> ... 6th Cup: Context, the classy way On variable locality
  109. class window.User constructor: (@id, @name) -> @element = $(“#user-#{@id}”) signOut:

    -> ... 6th Cup: Context, the classy way On variable locality
  110. class this.User constructor: (@id, @name) -> @element = $(“#user-#{@id}”) signOut:

    -> ... 6th Cup: Context, the classy way On variable locality
  111. class @User constructor: (@id, @name) -> @element = $(“#user-#{@id}”) signOut:

    -> ... 6th Cup: Context, the classy way On variable locality
  112. We’ve Covered ➡ Object Literals ➡ String Interpolation ➡ Functions

    ➡ Default Arguments ➡ Splats ➡ Ranges ➡ Pattern Matching ➡ Context and this ➡ Property Accessors ➡ Bound Functions ➡ Classes ➡ Inheritance ➡ super
  113. languagesOfChoice = (best, langs...) -> “I love #{best}, and I

    like #{langs.join(“, “)}” Follow-up: Existential Operator
  114. languagesOfChoice = (best, langs...) -> “I love #{best}, and I

    like #{langs.join(“, “)}” languagesOfChoice “Ruby” > I love Ruby, and I like Follow-up: Existential Operator
  115. languagesOfChoice = (best, langs...) -> “I love #{best}, and I

    like #{langs.join(“, “)}” languagesOfChoice “Ruby” > I love Ruby, and I like languagesOfChoice() > I love , and I like Follow-up: Existential Operator
  116. Follow-up: Existential Operator languagesOfChoice = (best, langs...) -> ret =

    [] if best? ret.push “I love #{best}” if langs.length > 0 ret.push “I like #{langs.join(“, “)}” ret.join(“, and “)
  117. languagesOfChoice = (best, langs...) -> ret = [] if best?

    ret.push “I love #{best}” if langs.length > 0 ret.push “I like #{langs.join(“, “)}” ret.join(“, and “) Follow-up: Existential Operator
  118. languagesOfChoice = (best, langs...) -> ret = [] if best?

    ret.push “I love #{best}” if langs.length > 0 ret.push “I like #{langs.join(“, “)}” ret.join(“, and “) Follow-up: Existential Operator
  119. languagesOfChoice = (best, langs...) -> ret = [] if best?

    ret.push “I love #{best}” if langs.length > 0 ret.push “I like #{langs.join(“, “)}” ret.join(“, and “) Follow-up: Existential Operator
  120. languagesOfChoice = (best, langs...) -> ret = [] if best?

    ret.push “I love #{best}” if langs.length > 0 ret.push “I like #{langs.join(“, “)}” ret.join(“, and “) Follow-up: Existential Operator
  121. languagesOfChoice “Ruby”, “JS”, “Python” > I love Ruby, and I

    like JS, Python Follow-up: Existential Operator
  122. languagesOfChoice “Ruby”, “JS”, “Python” > I love Ruby, and I

    like JS, Python languagesOfChoice “Ruby” > I love Ruby Follow-up: Existential Operator
  123. languagesOfChoice “Ruby”, “JS”, “Python” > I love Ruby, and I

    like JS, Python languagesOfChoice “Ruby” > I love Ruby languagesOfChoice undefined, “Ruby”, “JS” > I like Ruby, JS Follow-up: Existential Operator
  124. languagesOfChoice “Ruby”, “JS”, “Python” > I love Ruby, and I

    like JS, Python languagesOfChoice “Ruby” > I love Ruby languagesOfChoice undefined, “Ruby”, “JS” > I like Ruby, JS languagesOfChoice() > “” Follow-up: Existential Operator
  125. obj = x: { y: 2 } obj.x?.y if obj.x?

    then obj.x.y else undefined Follow-up: Existential Operator
  126. obj = x: { y: 2 } obj.x?.y if obj.x?

    then obj.x.y else undefined Follow-up: Existential Operator
  127. obj = x: { y: 2 } obj.x?.y if obj.x?

    then obj.x.y else undefined Follow-up: Existential Operator
  128. obj = x: { y: 2 } obj.x?.y if obj.x?

    then obj.x.y else undefined Follow-up: Existential Operator
  129. for i in [1..5] setTimeout (-> console.log i), 100 >

    5 > 5 > 5 > 5 > 5 Follow-up: Loop closures and do
  130. for i in [1..5] setTimeout (-> console.log i), 100 >

    5 > 5 > 5 > 5 > 5 Follow-up: Loop closures and do
  131. for i in [1..5] ((i) -> setTimeout (-> console.log i),

    100 )(i) > 1 > 2 > ... Follow-up: Loop closures and do
  132. for i in [1..5] do (i) -> setTimeout (-> console.log

    i), 100 > 1 > 2 > ... Follow-up: Loop closures and do
  133. A = [1, 2, 3, 4, 5] B = [8,

    7, 1, 2] cartesian = ([x, y] for x in A for y in B) Keep It Simple, Stupid Follow-up: Comprehension Madness
  134. (ret.push(val) unless val in ret) for val in orig when

    shouldAdd(val) Keep It Simple, Stupid Follow-up: Comprehension Madness