I'm working with promises & i can't understand it's behavior in node js.

```
function m1(txt) {
  return new Promise(resolve => {
    setTimeout(() => {
      console.log(txt + ' - done');
      resolve()
    }, 1000);
  });
}

var foo = m1('a');

foo.then(() =>  m1('b').then(() => console.log('do something immediately after b')));

foo.then(() => m1('c'));

```

Expected output, also getting it in chrome console.

```
a - done
b - done
do something immediately after b
c - done

```

But i'm getting following output in Node JS.

```
a - done
b - done
c - done
do something immediately after b

```

Kindly help i can't understand why this happening and what i do to get my expected output.