Created
November 12, 2016 10:00
-
-
Save victorvhpg/d4cabb26dc7bfceff849416590149398 to your computer and use it in GitHub Desktop.
This file contains 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
//modulo-teste.js | |
//exportando variaveis | |
export var cor = "amarelo"; | |
export let nome = "Pikachu"; | |
export const peso = 20; | |
// exportando function | |
export function soma(num1, num2) { | |
return num1 + num1; | |
} | |
// exportando class | |
export class Pokemon { | |
constructor(nome, cp) { | |
this.nome = nome; | |
this.cp = cp; | |
} | |
} | |
//funcao que não sera exportada, logo não acessível fora do módulo | |
function subtrai(num1, num2) { | |
return num1 - num2; | |
} | |
//criar uma funcao e depois exporta ela | |
function algumaCoisa() { | |
return "alguma coisa"; | |
} | |
//exportando uma referencia de função | |
export algumaCoisa; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment