Teach Me To Code » Screencasts (iPhone/iPod)

CoffeeScript: The Cool Parts


Listen Later

CoffeeScript offers more than nice syntax for setting and managing data and functions. It also offers Classes, Inheritance, access to a 'super' method, Ruby-style string interpolation, easy variable and function bindings, and chained comparisons.
Here's the code I showed in the video:
class Vehicle
constructor: (@name) ->
move: (miles) ->
console.log @name + " drove " + miles + " miles."
class VWBug extends Vehicle
move: ->
console.log "Cruisin'..."
super 100
class Truck extends Vehicle
move: ->
console.log "Haulin'..."
super 50
mater = new Truck "Mater"
herbie = new VWBug "Herbie"
mater.move()
herbie.move()
a1c = "7.6"
healthy = 7.0 > a1c > 5.0
console.log "A1C within healthy range: #{a1c}"
Account = (customer, cart) ->
@customer = customer
@cart = cart
$('.shopping_cart').click (event) =>
@customer.purchase @cart
If you're new to CoffeeScript, make sure you check out the CoffeeScript Cookbook and CoffeeScript Basics.
Download 150.3 MB
Download (iPod & iPhone) 87.1 MB
...more
View all episodesView all episodes
Download on the App Store

Teach Me To Code » Screencasts (iPhone/iPod)By Charles Max Wood

  • 4.3
  • 4.3
  • 4.3
  • 4.3
  • 4.3

4.3

3 ratings


More shows like Teach Me To Code » Screencasts (iPhone/iPod)

View all
JavaScript Jabber by Charles M Wood

JavaScript Jabber

235 Listeners

iPhreaks by Charles M Wood

iPhreaks

17 Listeners

Ruby Rogues by Charles M Wood

Ruby Rogues

45 Listeners

The Freelancers' Show by Charles M Wood

The Freelancers' Show

23 Listeners

Adventures in Angular by Charles M Wood

Adventures in Angular

33 Listeners

React Native Radio by Jamon Holmgren, Robin Heinze, Mazen Chami

React Native Radio

57 Listeners

My JavaScript Story by Charles M Wood

My JavaScript Story

4 Listeners

JavaScript Jabber by Charles M Wood

JavaScript Jabber

61 Listeners

Ruby Rogues by Charles M Wood

Ruby Rogues

21 Listeners

Adventures in Angular by Charles M Wood

Adventures in Angular

15 Listeners