Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

0

Share

Download to read offline

Coffee script

Download to read offline

CoffeeScript

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

Coffee script

  1. 1. https://youtu.be/DspYurD75Ns?t=43 CoffeeScript
  2. 2. CoffeeScript created by Jeremy Backbone.js transpile to ES5 Syntax Sugar adopted by node.js Ruby
  3. 3. Less is More var ; () {}
  4. 4. Lambda (arrow) Callback function is simple.
  5. 5. Slice Splats…
  6. 6. Comprehension if, for generates list list.filter(item != 2).map(item => print item) for (item <- list; item != 2) yield print item
  7. 7. Operator Alias Write codes like speaking English. on, yes -> true is -> ===
  8. 8. Class class Car name: “Prius” mycar: -> console.log “My car is #{@name}” c1 = new Car() c1.mycar() // “My car is Prius”
  9. 9. Prototype base class : JS class is based on prototype based OOP
  10. 10. Prototype Property {}c1 = new Car() new create a blank object {} and a link to Car.prototype Car = function() { // prototype is created implicitly } Car.prototype.name = “Prius” c1.name Prototype Chain look up prototype.name if name does not exist.
  11. 11. this c1 = new Car() { name : “Prius”, mycar : function()… } Car = function() { this.name = “Prius” this.mycar = function() } Window.name = “Prius” c2 = new Car() { name : “Prius”, mycar : function()… } c3 = Car()
  12. 12. Copy on write Car.prototype c1 = new Car() {name : “Prius x”} { name : “Porche”, mycar : function()… } c1.name = “Prius x” {} c2 = new Car() creates a prop name in c1

CoffeeScript

Views

Total views

269

On Slideshare

0

From embeds

0

Number of embeds

6

Actions

Downloads

2

Shares

0

Comments

0

Likes

0

×