coffee script part one

Post on 14-Jan-2017

293 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

COFFEESCRIPTMax Peng

@make_dream hwpeng@thoughtworks.com

P a r t o n e - b a s i c

HISTORY

2

HISTORY

➡Dec 13, 2009, Jeremy Ashkenas made the first commit; ➡Dec 24, 2009, first release - 0.1.0; ➡Feb 21, 2010, version - 0.5, replaced Ruby compiler with pure CoffeeScript; ➡Dec 24, 2010, version - 1.0.0, announced for the first time; ➡Apr 13, 2011, CoffeeScript support is included in RoR version 3.1; ➡Oct 14, 2015, version - 1.10.0, 4051 commits, 62 releases, 182 contributors;

3

GETTING STARTED

4

Installation: npm install -g coffee-script

Execute a script: coffee /path/to/script.coffee

Compile a script: coffee -c /path/to/script.coffee

Or: http://coffeescript.org/

GETTING STARTED

5

SYNTAX

6

HELLO WORLD

7

FUNCTIONS

8

OBJECTE

9

ARRAY

10

IF-ELSE & UNLESS & IF-THEN-ELSE

11

SWITCH CASE

12

LIST COMPREHENSION

13

OPERATORS AND ALIASES

14

PATTERN MATCHING

15

EXISTENTIAL OPERATOR

16

CLASS

17

THANKS

18

QUESTIONS

19

➡ Difference between -> and => ➡ …(arguments object)

REFERENCES

20

➡https://en.wikipedia.org/wiki/CoffeeScript ➡http://coffeescript.org/ ➡https://github.com/jashkenas/coffeescript

top related