Code:
// {}new Object()Object.create(null)
isPlainObject: function( obj ) {
var proto, Ctor;
// toStringobjObject
if ( !obj || toString.call( obj ) !== "[object Object]" ) {
return false;
}
//
proto = getProto( obj );
// Object.create( null )true
if ( !proto ) {
return true;
}
// new Object()
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
// fnToString: ObjectFunctionString:function Object() { [native code] }
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
}
doubt:
Object.prototype.toString.call()new Object(){}Object()[object Object]