Created
March 26, 2017 02:59
-
-
Save cristofersousa/9cb503512ac61c334d69b875260f918b 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
let name = 'Opensanca'; // nossa variável global | |
function sayName() { | |
let name; // nossa variável local de mesmo nome que a global | |
console.log(name); // chamando a variável local dentro da function | |
let = "Opensanca"; // nossa variavel global foi para dentro da function pois ocorreu o hoisting e com isso não temos nenhuma atribuição global para o JS o que resulta em `undefined` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment