Skip to content

Instantly share code, notes, and snippets.

@rahulbanerjee26
Created July 6, 2022 04:10
Show Gist options
  • Save rahulbanerjee26/e97a4ff46dcc10d4183ba51c1ba330ce to your computer and use it in GitHub Desktop.
Save rahulbanerjee26/e97a4ff46dcc10d4183ba51c1ba330ce to your computer and use it in GitHub Desktop.
let names = ['Rahul','Rohit','Rohan']
function addNewName(name){
setTimeout(function(){
names.push(name)
},5000)
}
function printNames(){
setTimeout(function(){
console.log(names)
},3000)
}
addNewName('Alex')
printNames()
// Output:
// [ 'Rahul', 'Rohit', 'Rohan' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment