This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| helloWorld = (street = "Lille") -> console.log "Hello world from #{street}." | |
| helloWorld() | |
| # Hello world from Lille. | |
| helloWorld("Paris") | |
| # Hello world from Paris. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = (a, b..., c) -> | |
| f("a", "foo", "bar", "baz", 42) | |
| # b => [ 'foo', 'bar', 'baz' ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f("a", 42) | |
| b # [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [a..., b] = ["foo", "bar", 42] | |
| a # [ 'foo', 'bar' ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.App = class App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| person = { firstname: "Martin", lastname: "Catty" } | |
| person.introduce = -> console.log "Bonjour, je suis #{@firstname} #{@lastname}." | |
| person.introduce() | |
| # Bonjour, je suis Martin Catty. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setAttribute = (attribute) -> @attribute = attribute |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setAttribute = (@attribute) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| registerEvents = (node) -> | |
| node.bind "click", (event) => | |
| # this est bindé sur le this avant l'appel et non sur l'event |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.Animal = class Animal | |
| window.Dog = class Dog extends Animal | |
| # convention pour une constante mais utilise var | |
| STATES = ["sleeping", "eating"] | |
| constructor: -> | |
| # appelle le constructeur d'Animal | |
| super |