Created
May 24, 2017 23:20
-
-
Save durvalrafael/5d6e8c243113a369591ae5a85aab828b to your computer and use it in GitHub Desktop.
Exemplo de arrow function
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
| class Teste { | |
| constructor() { | |
| this.init(); | |
| } | |
| init(){ | |
| //Arrow Funcion | |
| let showMessage = (message) => { | |
| //não perde o escopo (this) | |
| return this.getMessage(this.getMessage()); | |
| } | |
| console.log(showMessage()); | |
| } | |
| getMessage(){ | |
| return "Olá"; | |
| } | |
| } | |
| var teste = new Teste(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment