CoffeeSc"pt       gettingstarted 2011.08.08  Outsider
Howtorun
inWebBrowserscripttype=”coffee-script.js”scripttype=”text/coffeescript”//coffeescriptcode/script
inOSXorLinux    -installnode.js    -installnpm$npminstall-gcoffee-script$coffee
inWindows                               useCoffeeScriptCompiler    ForWindows      https://github.com/alisey/CoffeeScript-...
Function
함수를정의한다          -
생략        괄호:()      중괄호:{}     세미콜론:;
-‘HelloWorld’do-‘HelloWorld’(-‘HelloWorld’)()
함수의마지막표현식이  자동으로리턴된다(return문을사용할수도있다)
이름있는함수는변수에할당 greeting=-‘HelloWorld’
파라미터  print=(msg)-msg
Interpolation:“#{}” p=(msg)-“hello#{msg}”  p=(msg)-‘hello‘+msg
+오퍼레이터는공백에따라다르다     ‘frends’+5//frends5    ‘frends’+5//TypeError
Operator                   is//===           isnt//!==                    not//!           and//                     or//|...
Contidional             iftruethen1                    1iftrue    iftruethen1else2             1unlesstrue
존재여부확인        값이있거나 undefined나null이아니면        trueunlessa?                 a?b            a?=b
Scope
변수의범위      모든함수는범위를만든다 변수가할당된최상위범위에서존재    범위밖에서는접근할수없다
Context
this       @
현재컨택스트로this고정              =                 not-
프로퍼티setName=(name)-@name=name      setName=(@name)-
기본값func=(a=true)-...
Splats:...        func=(a,b...)-    func=(a,b...,c)-         func-(a...,b)-
Splats:...   user=[1,2,3,4,5]             [a...,b]=user
Upcoming SlideShare
Loading in...5
×

Coffeescript - Getting Started

2,930

Published on

FRENS의 JavaScript Application Framework 스터디에서 한 발표 자료

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,930
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
16
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Coffeescript - Getting Started

  1. 1. CoffeeSc"pt gettingstarted 2011.08.08 Outsider
  2. 2. Howtorun
  3. 3. inWebBrowserscripttype=”coffee-script.js”scripttype=”text/coffeescript”//coffeescriptcode/script
  4. 4. inOSXorLinux -installnode.js -installnpm$npminstall-gcoffee-script$coffee
  5. 5. inWindows useCoffeeScriptCompiler ForWindows https://github.com/alisey/CoffeeScript-Compiler-for-Windows
  6. 6. Function
  7. 7. 함수를정의한다 -
  8. 8. 생략 괄호:() 중괄호:{} 세미콜론:;
  9. 9. -‘HelloWorld’do-‘HelloWorld’(-‘HelloWorld’)()
  10. 10. 함수의마지막표현식이 자동으로리턴된다(return문을사용할수도있다)
  11. 11. 이름있는함수는변수에할당 greeting=-‘HelloWorld’
  12. 12. 파라미터 print=(msg)-msg
  13. 13. Interpolation:“#{}” p=(msg)-“hello#{msg}” p=(msg)-‘hello‘+msg
  14. 14. +오퍼레이터는공백에따라다르다 ‘frends’+5//frends5 ‘frends’+5//TypeError
  15. 15. Operator is//=== isnt//!== not//! and// or//|| true,yes,on//true false,no,off//false
  16. 16. Contidional iftruethen1 1iftrue iftruethen1else2 1unlesstrue
  17. 17. 존재여부확인 값이있거나 undefined나null이아니면 trueunlessa? a?b a?=b
  18. 18. Scope
  19. 19. 변수의범위 모든함수는범위를만든다 변수가할당된최상위범위에서존재 범위밖에서는접근할수없다
  20. 20. Context
  21. 21. this @
  22. 22. 현재컨택스트로this고정 = not-
  23. 23. 프로퍼티setName=(name)-@name=name setName=(@name)-
  24. 24. 기본값func=(a=true)-...
  25. 25. Splats:... func=(a,b...)- func=(a,b...,c)- func-(a...,b)-
  26. 26. Splats:... user=[1,2,3,4,5] [a...,b]=user
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×