I've been trying to run the following code but only the second function runs and the first one does not execute. Can anyone please let me know what's wrong.
function first() {
setTimeout(function(){
console.log(1);
}, 500 );
};
function second(first) {
console.log(2);
};
second();
What I'm expecting is that the program first displays 1 after 500ms and then 2.