hasownproperty: used to determine whether an object has an attribute or object with the name given by you. However, you must note that this method cannot check whether the property exists in the prototype chain of the object. The property must be a member of the object.
isprototypeof is used to determine whether the object of the prototype chain exists in the specified object instance. If yes, true is returned. Otherwise, false is returned.
function siteadmin (nickname, sitename) {This. nickname = nickname; this. sitename = sitename;} siteadmin. prototype. showadmin = function () {alert (this. nickname + "yes" + this. sitename + "webmaster! ")}; Siteadmin. prototype. showsite = function (siteurl) {This. siteurl = siteurl; return this. the address of sitename + "is" + this. siteurl ;}; var Matou = new siteadmin ("", "Web Front-end development"); var matou2 = new siteadmin ("", "Web Front-end development "); matou. age = "30"; // Matou. showadmin (); // alert (Matou. showsite ("http://www.css88.com/"); alert (Matou. hasownproperty ("nickname"); // truealert (Matou. hasownproperty ("Age"); // truealert (Matou. hasownproperty ("showadmin"); // falsealert (Matou. hasownproperty ("siteurl"); // falsealert (siteadmin. prototype. hasownproperty ("showadmin"); // truealert (siteadmin. prototype. hasownproperty ("siteurl"); // falsealert (siteadmin. prototype. isprototypeof (Matou) // truealert (siteadmin. prototype. isprototypeof (matou2) // true