I have this code:

```
console.log('1');
process.nextTick(() => console.log('inside nextTick'));
setImmediate(()=> console.log('inside setImmediate'));
console.log("2");
for(var i=0;i<1 ; i++) {
    console.log("inside for loop");
}

```

And output is:

```
1
2
inside for loop
inside nextTick
inside setImmediate

```

Please explain why it is happening. Even if I have written `console.log("2");` and the `for loop` after `process.nextTick` and `setImmediate`, why are they executing before them?