Skip to content

Instantly share code, notes, and snippets.

@rodrwan
Created April 8, 2017 23:29
Show Gist options
  • Save rodrwan/09b70cb29a4b120e131495ddf90a3a45 to your computer and use it in GitHub Desktop.
Save rodrwan/09b70cb29a4b120e131495ddf90a3a45 to your computer and use it in GitHub Desktop.
// ejemplo de variable local
function hi () {
const saludo = 'hola mundo'
}
// saludo, solo se puede utilizar dentro de la funcion hi.
// ---------------------
// variable counter esta declarada en el scope global de javascript por ende
// puede ser utilizada por otras funciones
let counter = 0
function change1() {
counter = 1
}
function change2() {
counter = 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment