In the following code, why test function's second this points to obj, whereas the first this points to window object?
In particular, how can I guess the value of this by looking at a piece of code?
var test = function(){
    console.log('first', this)
    return function(){
        console.log('second', this)
    }
}
var obj = {
    a: 1,
    b: test()
}
obj.b() // execute function
 
    