Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

planned last module

  • Loading branch information...
commit 2a376fab45e33d94f3d5f31a4fa99ab0844e88a5 1 parent fe1f150
@liammclennan authored
View
10 examples/data-types/01-ranges.coffee
@@ -0,0 +1,10 @@
+
+start = [0..9]
+console.log start[4..7]
+
+days = ['sun','mon','tue','wed','thu','fri','sat']
+weekdays = days[1..5]
+console.log weekdays
+
+sentence = "the quick brown fox"
+console.log sentence[9...sentence.length]
View
14 examples/data-types/02-regular-expressions.coffee
@@ -0,0 +1,14 @@
+input = "Text with some <strong>highlighted</strong> parts."
+expression = /<strong>(.*)<\/strong>/
+results = expression.exec(input)
+console.log results
+
+
+input = "Text with some <strong>highlighted</strong> parts."
+expression = ///
+ <strong> # opening of strong tag
+ (.*) # tag value
+ </strong> # close of strong tag
+///
+results = expression.exec(input)
+console.log results
View
18 examples/data-types/03-function-binding.coffee
@@ -0,0 +1,18 @@
+
+
+fruit = {
+ name:'apple'
+ describe: -> console.log this.name
+}
+fruit.describe()
+
+fruit = {
+ name:'apple'
+ describe: ->
+ setTimeout(=>
+ console.log this.name
+ null
+ , 1000)
+ null
+}
+fruit.describe()
View
18 examples/data-types/04-classes.coffee
@@ -0,0 +1,18 @@
+class Person
+ constructor: (@name, @age) ->
+
+ describe: -> console.log "#{@name} is #{@age} years old"
+
+liam = new Person 'Liam', 28
+liam.describe()
+
+class Male extends Person
+ @TITLE = "Mr"
+
+ describe: ->
+ console.log Male.TITLE
+ super
+
+liam = new Male 'Liam', 28
+liam.describe()
+
View
5 examples/language-elements/02_chained_comparisons.coffee
@@ -0,0 +1,5 @@
+if a < b < c
+ 1
+
+if a is b is c
+ 2
View
22 examples/language-elements/03_while_loops.coffee
@@ -0,0 +1,22 @@
+letters = ['a','b','c','d']
+
+reversed = while letters.length > 0
+ letters.pop()
+
+console.log reversed
+
+letters = ['a','b','c','d']
+
+reversed = until letters.length is 0
+ letters.pop()
+
+console.log reversed
+
+letters = ['a','b','c','d']
+
+largest_index = letters.length-1
+reversed = for item,index in letters
+ letters[largest_index - index]
+
+console.log reversed
+
View
0  examples/fizzbuzz.js → examples/working-with-coffeescript/fizzbuzz.js
File renamed without changes
View
0  examples/fizzbuzz_expression.coffee → ...king-with-coffeescript/fizzbuzz_expression.coffee
File renamed without changes
View
0  examples/fizzbuzz_refactored.coffee → ...king-with-coffeescript/fizzbuzz_refactored.coffee
File renamed without changes
View
0  examples/word_counter.coffee → ...les/working-with-coffeescript/word_counter.coffee
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.