Created
July 6, 2022 04:10
-
-
Save rahulbanerjee26/e97a4ff46dcc10d4183ba51c1ba330ce 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 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