code_0:
(calling foo without parentheses)
function foo(){
console.log(\'hello world\');
}
setTimeout(foo, 2000);
This
In the first code snippet, the function foo is being passed to the timeout. That means that foo gets called after 2 seconds when the timeout expires.
In the second code snippet, the function foo is being called to decide what to pass to the timeout. So foo gets called before the timeout is set. Since foo() doesn't return anything, nothing happens when the timeout expires.