Last active
March 16, 2017 20:30
-
-
Save gustavo-rodrigues-dev/4dba3894ec2a1f51e54bfaf444c6ced3 to your computer and use it in GitHub Desktop.
exemple fail
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
function add(name){ | |
setTimeout(function(){ | |
names.push(name); | |
}, 100); | |
return name; | |
} | |
console.log(names); // [] | |
console.log(add('Gustavo')); // Gustavo | |
console.log(names); // [] | |
//when exists data | |
setTimeout(function(){ | |
console.log(names) // ['Gustavo'] | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment