mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00

* Update classes docs for CS2 * Port breaking changes from https://github.com/jashkenas/coffeescript/wiki/%5BWIP%5D-Breaking-changes-in-CoffeeScript-2 into new docs section * Update browser compiler * Update re @connec’s notes; split classes section into two sections for classes and working with prototypes; make breaking changes examples editable whenever possible
9 lines
301 B
CoffeeScript
9 lines
301 B
CoffeeScript
class Teenager
|
|
@say: (speech) ->
|
|
words = speech.split ' '
|
|
fillers = ['uh', 'um', 'like', 'actually', 'so', 'maybe']
|
|
output = []
|
|
for word, index in words
|
|
output.push word
|
|
output.push fillers[Math.floor(Math.random() * fillers.length)] unless index is words.length - 1
|
|
output.join ', '
|