promise resolutions

illustration of resolutions in JavaScript Promises

by Gerald Gillespie

JavaScript

var O = function(){

var q = new Promise(function(res, rej){
  reject();
});

console.log('what about this?',this);
var p = new Promise(function(res, rej){
	res(1);
  console.log('and this?',this);

});


p.thisChk = 'yo';
console.log( p.then( function(r){
	console.log('this?',this);
  return q;
})) ;
this.p = p;

return this;

};



var  obj = new O();

console.log(obj);