{"id":912,"date":"2022-03-10T21:27:38","date_gmt":"2022-03-10T13:27:38","guid":{"rendered":"http:\/\/www.henrycome.com\/wordpress\/?p=912"},"modified":"2022-03-10T21:27:38","modified_gmt":"2022-03-10T13:27:38","slug":"20220310212713","status":"publish","type":"post","link":"http:\/\/www.henrycome.com\/wordpress\/202203102127\/912","title":{"rendered":"P58-73-\u5bf9\u8c61.js"},"content":{"rendered":"<pre><code class=\"language-javascript\">\/*P58-\u5bf9\u8c61-\u521b\u5efa\u5bf9\u8c61\n\/\/JS\u7684\u8bbe\u8ba1\u89c4\u8303\u57fa\u4e8e\u5bf9\u8c61\u539f\u578b\u7684\uff0c\u4e0e\u5176\u4ed6\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u7c7b\u4f3c\uff0c\u4f46\u66f4\u7075\u6d3b\u3002\n\/\/\u63cf\u8ff0\u5ba2\u89c2\u4e16\u754c\u7684\u7269\u4f53\uff0c\u7279\u5f81\u548c\u884c\u4e3a\u3002\n\n\/\/\u521b\u5efa\u5bf9\u8c61\u6709\u5f88\u591a\u65b9\u5f0f\uff1a\n\/\/\u65b9\u6cd51\uff1a\u6700\u76f4\u89c2\u7684\u662f\u5b57\u9762\u503c\uff08\u5bf9\u8c61\u521d\u59cb\u5316\u5668\uff09\uff0c\n\/\/\u4e00\u4e2a\u5927\u62ec\u53f7\uff0c\u548c\u4f5c\u7528\u57df\u662f\u4e0d\u4e00\u6837\u7684\u3002\n\/\/\u521d\u59cb\u5316\u5668{}\u91cc\u9762\u4f7f\u7528\u952e\u503c\u5bf9\uff0c\u5c31\u662fkey:value\u7684\u6837\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u952ekey\u83b7\u53d6\u5bf9\u8c61\u7684\u5c5e\u6027\u6216\u65b9\u6cd5\u5bf9\u5e94\u7684\u503c\n\/\/\u591a\u4e2a\u5c5e\u6027\u4f7f\u7528\u9017\u53f7\u9694\u5f00\n\/\/\u952e\u503c\u5bf9\u7684\u503c\u90e8\u5206\u53ef\u4ee5\u662f\u591a\u79cd\u7c7b\u578b\uff0c\u4e0e\u53d8\u91cf\u4e00\u6837\u3002\u53ef\u4ee5\u8ba4\u4e3a\u662f\u5b9a\u4e49\u5728\u5bf9\u8c61\u91cc\u9762\u7684\u53d8\u91cf\n\nvar employee={\n    name:&#039;\u5f20\u4e09&#039;,\n    age:20,\n    position:&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;,\n    signIn:function(){\n        console.log(&#039;\u5f20\u4e09\u6253\u5361&#039;);\n    }\n}\n\n\/\/\u65b9\u6cd52\uff1a\u4f7f\u7528 new object()\u8bed\u6cd5\uff0c\u521b\u5efa\u7a7a\u5bf9\u8c61\uff0c\u518d\u53bb\u6dfb\u52a0\u5c5e\u6027\nvar employee2 =new Object();\nemployee2.name = &#039;\u674e\u56db&#039;;\nemployee2.signIn = function(){\n    console.log(&#039;\u674e\u56db\u6253\u5361&#039;);\n}\n\n\/** *\/\n\n\/*P59-\u5bf9\u8c61-\u5bf9\u8c61\u5c5e\u6027\n\/\/\u5bf9\u8c61\u7684\u6bcf\u4e2a\u952e\u503c\u5bf9\uff0c\u90fd\u662f\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u53ef\u4ee5\u6709\u4efb\u4f55\u503c\uff08\u8ddf\u53d8\u91cf\u4e00\u6837\uff09\uff1a\u6570\u5b57\uff0c\u5b57\u7b26\u4e32\uff0c\u6570\u7ec4\uff0c\u51fd\u6570\uff0c\u6216\u8005\u662f\u53e6\u4e00\u4e2a\u5bf9\u8c61\n\/\/\u5982\u679c\u67d0\u4e2a\u5c5e\u6027\u7684\u503c\u662f\u51fd\u6570\uff0c\u8fd9\u4e2a\u5c5e\u6027\u4e5f\u53ef\u4ee5\u53eb\u505a\u65b9\u6cd5\n\n\/\/\u8bbf\u95ee\u5bf9\u8c61\u5c5e\u6027\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u662f.\u4e5f\u53ef\u4ee5\u7528[&#039;key&#039;]\u6570\u7ec4\u90a3\u6837\u65b9\u5f0f\nvar employee={\n    name:&#039;\u5f20\u4e09&#039;,\n    age:20,\n    position:&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;,\n    signIn:function(){\n        console.log(&#039;\u5f20\u4e09\u6253\u5361&#039;);\n    }\n}\n\nconsole.log(employee.name);\/\/\u5f20\u4e09\nconsole.log(employee[&#039;name&#039;]);\/\/\u5f20\u4e09\/\/\u6ce8\u610f\u8fd9\u91cc\u6ca1\u6709\u70b9\u53f7\uff0c\u800c\u4e14\u952e\u540d\u662f\u5b57\u7b26\u4e32\u5f62\u5f0f\u5e26\u5f15\u53f7\u624d\u884c\u3002\n\n\/\/\u66f4\u65b0\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u4e5f\u7528.\u53d6\u51fa\uff0c\u7528=\u6765\u8d4b\u65b0\u503c\uff0c\u548c\u53d8\u91cf\u4e00\u6837\u3002\nemployee.name=&#039;\u5f20\u4e94&#039;;\nconsole.log(employee.name);\/\/\u5f20\u4e94\n\/\/\u4e5f\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u6837\u5f0f\u7684[&#039;key&#039;]\u7684\u6837\u5f0f\nemployee[&#039;name&#039;]=&#039;\u5f20\u516d&#039;;\nconsole.log(employee.name);\/\/\u5f20\u516d\n\n\/\/\u53ef\u4ee5\u6dfb\u52a0\u6ca1\u6709\u7684\u5c5e\u6027\uff0c\u4f46\u662f\u4e0d\u80fd\u8bbf\u95ee\u6ca1\u6709\u7684\u5c5e\u6027\nvar employee2 =new Object();\nemployee2.name = &#039;\u674e\u56db&#039;;\nemployee2.signIn = function(){\n    console.log(&#039;\u674e\u56db\u6253\u5361&#039;);\n}\n\nconsole.log(employee2.age);\/\/undefined\nemployee2.age=22;\nconsole.log(employee2.age);\/\/22\n\n\/\/key\u4e00\u822c\u4e0d\u7528\u5f15\u53f7\uff0c\u4f46\u662f\u7279\u6b8a\u60c5\u51b5\u9700\u8981\n\/\/\u800c\u4e14\u52a0\u4e86\u5f15\u53f7\uff0c\u53ea\u80fd\u4f7f\u7528\u6570\u7ec4[]\u6837\u5f0f\u6765\u8bbf\u95ee\u8fd9\u4e2a\u5c5e\u6027\n\nvar employee3={\n    name:&#039;\u738b\u4e94&#039;,\n    \/\/birth-date:&#039;1990-3-2&#039;,\/\/Uncaught SyntaxError: Unexpected token &#039;-&#039;\n    &#039;birth-date&#039;:&#039;1990-3-2&#039;,\n}\nconsole.log(employee3[&quot;birth-date&quot;]);\/\/1990-3-2\/\/\u800c\u4e14\u8fd9\u91cc\u662f\u8f6f\u4ef6\u81ea\u52a8\u66f4\u6b63\uff0c\u5b83\u5b57\u7b26\u4e32\u4f7f\u7528\u53cc\u5f15\u53f7\uff0c\u6211\u4e00\u822c\u7528\u5355\u5f15\u53f7\u3002\u6211\u521a\u624d\u53ea\u8f93\u5165\u4e86.birth\u8fd9\u6837\uff0c\u8f6f\u4ef6\u5c31\u80fd\u6709\u63d0\u793a\u4e86\u3002\n\n\/\/\u5b9e\u9645\u7f16\u7a0b\u7684\u65f6\u5019\uff0c\u5efa\u8bae\u90fd\u4f7f\u7528\u9a7c\u5cf0\u65b9\u5f0f\u6765\u547d\u540d\u53d8\u91cf\u548c\u5c5e\u6027\n\/\/\u8c03\u7528\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528.\u6765\u83b7\u53d6\u5c5e\u6027\u503c\uff0c\u6bd4\u8f83\u65b9\u4fbf\nvar employee4={\n    name:&#039;\u738b\u4e94&#039;,\n    \/\/birth-date:&#039;1990-3-2&#039;,\/\/Uncaught SyntaxError: Unexpected token &#039;-&#039;\n    birthDate:&#039;1990-3-2&#039;,\n}\nconsole.log(employee4.birthDate);\/\/1990-3-2\n\/** *\/\n\n\/*P60-\u5bf9\u8c61-\u7701\u7565key\n\/\/\u5982\u679c\u4f7f\u7528\u5b57\u9762\u503c\u65b9\u5f0f\u5b9a\u4e49\u5bf9\u8c61\u7684\u65f6\u5019\uff0c\u5982\u679c\u5c5e\u6027\u503c\u662f\u4e00\u4e2a\u53d8\u91cf\uff0c\u800c\u4e14\u53d8\u91cf\u540d\u548c\u5b83\u7684key\u540d\u4e00\u6837\uff0c\u53ef\u4ee5\u7701\u7565key\n\/\/\u4e0b\u4f8b\u5c5e\u6027name\u548c\u503cname\u53d8\u91cf\u91cd\u540d\uff0c\u53ef\u4ee5\u53ea\u5199\u4e00\u4e2a\n\/\/\u51fd\u6570\u7684\u8bdd\uff0c\u53ef\u4ee5\u628afunction\u5173\u952e\u5b57\u6539\u6210\u5c5e\u6027\u540d\u5373\u53ef\nvar name=&#039;\u674e\u56db&#039;;\nvar name2=&#039;\u738b\u4e94&#039;;\nvar employee5={\n    name : name,\/\/\u8fd9\u91cc\u8001\u5e08\u6ca1\u6709\u52a0\u9017\u53f7\uff0c\u800c\u4e14vscode\u7ed9\u628a\u7b2c\u4e8c\u4e2aname\u753b\u4e86\u6a2a\u7ebf\uff0c\u63d0\u793a\u4fe1\u606f\u662f&quot;name&quot;\u5df2\u5f03\u7528 ts(6385)\n    name2,\/\/\u5199\u6210\u4e00\u4e2aname\u4e5f\u662f\u53ef\u4ee5\u7684\n    signIn:function(){console.log(&#039;\u6253\u5361&#039;);},\/\/\u6807\u53f794\n    signIn2(){console.log(&#039;\u6253\u5361&#039;)}\/\/\u6807\u53f795\n}\nconsole.log(employee5.name);\/\/\u674e\u56db\nconsole.log(employee5.name2);\/\/\u738b\u4e94\nconsole.log(employee5.signIn);\/\/\u0192 (){console.log(&#039;\u6253\u5361&#039;);}\nconsole.log(employee5.signIn2);\/\/\u0192 signIn2(){console.log(&#039;\u6253\u5361&#039;)}\nconsole.log(employee5.signIn());\/\/\u6807\u53f794\uff1a\u6253\u5361 \u672c\u884c\u6807\u53f7undefined\/\/\u56e0\u4e3a\u6ca1\u6709\u8fd4\u56de\u503c\u6240\u4ee5\u662fundefined\nconsole.log(employee5.signIn2());\/\/\u6807\u53f795\uff1a\u6253\u5361 \u672c\u884c\u6807\u53f7undefined\/\/\u56e0\u4e3a\u6ca1\u6709\u8fd4\u56de\u503c\u6240\u4ee5\u662fundefined\n\/** *\/\n\n\/*P61-\u5bf9\u8c61-\u904d\u5386\n\/\/2\u79cd\u65b9\u6cd5\uff1a1st\u4f7f\u7528Object.keys()\u8fd9\u4e2a\u65b9\u6cd5\uff1b2\u4f7f\u7528forin\u5faa\u73af\n\/\/1st\u4f7f\u7528Object.keys()\u8fd9\u4e2a\u65b9\u6cd5\uff1b\nvar employee={\n    name:&#039;\u5f20\u4e09&#039;,\n    age:20,\n    position:&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;,\n    signIn:function(){\n        console.log(&#039;\u5f20\u4e09\u6253\u5361&#039;);\n    }\n}\n\nconsole.log(Object.keys(employee));\/\/(4)\u00a0[&quot;name&quot;, &quot;age&quot;, &quot;position&quot;, &quot;signIn&quot;]\n\n\/\/2nd\u79cd\u662fforin\u5faa\u73af,in\u524d\u9762\u662f\u7ed9\u8fd4\u56de\u7684\u5c5e\u6027\uff08key\uff09\u8d77\u4e00\u4e2a\u53d8\u91cf\u540d\u5b57\uff0cin\u540e\u9762\u662f\u9700\u8981\u904d\u5386\u5c5e\u6027\u7684\u5bf9\u8c61\n\/\/\uff1f\u5728P67\u7684\u65f6\u5019\uff0c\u4f7f\u7528for(key in emp1)\u4f1a\u62a5\u9519\uff0cUncaught ReferenceError: key is not defined\n\/\/\u53ef\u4ee5\u6539\u6210for(key in emp1)\u6216\u5148\u58f0\u660e\u4e00\u4e0bvar key;\u3010https:\/\/www.cnblogs.com\/bqh10086\/p\/12444757.html\uff0c\n\/\/\u4f46\u662f\u628a\u4ee3\u7801\u590d\u5236\u5230\u6559\u7a0b\u7684\u7f51\u9875\u7f16\u8f91\u6846\u4e0d\u4f1a\u62a5\u9519\uff1ahttps:\/\/www.runoob.com\/jsref\/jsref-forin.html\n\/\/\u67e5\u770b\u8001\u5e08\u7684\u6559\u7a0b\u786e\u5b9e\u6ca1\u6709\u5148\u58f0\u660e\uff0c\u7136\u540e\u8fd0\u884c\u5f53\u65f6\u7684\u4ee3\u7801\uff08\u4e0b\u9762\uff09\u786e\u5b9e\u4f1a\u62a5\u9519\u3002\n\/\/\u7f51\u4e0a\u4e5f\u6709\u548c\u8001\u5e08\u8bb2\u7684\u4e00\u6837\u4e0d\u7528\u5173\u952e\u5b57\uff0c\u4f46\u590d\u5236\u4e0b\u6765\u8fd0\u884c\u90fd\u6709\u9519\u3011https:\/\/blog.csdn.net\/lx678111\/article\/details\/81239638\n\/\/for(key in employee)\/\/\u8001\u5e08\u8bb2\u7684\u662f,\u4e00\u5f00\u59cb\u5199\u7b14\u8bb0\u65f6\u5019\u6ca1\u9519\uff0c\u540e\u6765\u51fa\u9519\uff0c\u8be6\u60c5\u770b\u4e0a\u9762\u4ecb\u7ecd\u3002\nfor(let key in employee){\n    console.log(key);\n}\n\/*\n\/\/\u8fd9\u4e2a\u5faa\u73af\u81ea\u52a8\u6267\u884c\u3002\n name\n age\n position\n signIn\n*\/\n\/**\/\n\n\/*P62-\u5bf9\u8c61-\u5220\u9664\u5c5e\u6027\n\/\/\u4f7f\u7528delete\u5173\u952e\u5b57\n\nvar employee={\n    name:&#039;\u5f20\u4e09&#039;,\n    age:20,\n    position:&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;,\n    signIn:function(){\n        console.log(&#039;\u5f20\u4e09\u6253\u5361&#039;);\n    }\n}\n\ndelete employee.name;\nconsole.log(employee);\/\/{age: 20, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, signIn: \u0192}\nconsole.log(Object.keys(employee));\/\/(3)\u00a0[&quot;age&quot;, &quot;position&quot;, &quot;signIn&quot;]\n\n\/\/\u5b66\u4ee5\u81f4\u7528\uff0c\u4f7f\u7528forin\nfor(key in employee){\n    console.log(key);\n}\n\/*\n\/\/\u5df2\u7ecf\u6ca1\u6709name\u8fd9\u4e2a\u5c5e\u6027\u4e86\u3002\nage\nposition\nsignIn\n*\/\n\n\/** *\/\n\n\/*P63-\u5bf9\u8c61-\u6784\u9020\u51fd\u6570\n\/\/\u4f7f\u7528\u6784\u9020\u51fd\u6570\u662f\u53e6\u4e00\u4e2a\u521b\u5efa\u5bf9\u8c61\u7684\u65b9\u5f0f\n\/\/\u548c\u5b57\u9762\u503c\uff0cnew Object()\u76f8\u6bd4\uff0c\u6784\u9020\u51fd\u6570\u521b\u5efa\u65b0\u5bf9\u8c61\uff0c\u53ef\u4ee5\u6307\u5b9a\u9ed8\u8ba4\u5c5e\u6027\u3002\n\/\/\u4f7f\u7528new\u5173\u952e\u5b57\u521b\u5efa\u5bf9\u8c61\u5b9e\u4f8b\u3002\u5b9e\u4f8b\u5c31\u662f\u6839\u636e\u6784\u9020\u51fd\u6570\u521b\u5efa\u51fa\u6765\u7684\u65b0\u5bf9\u8c61\n\/\/\u7528\u5de5\u5382\u505a\u6bd4\u55bb\uff0c\u6c7d\u8f66\u5c31\u662f\u5b9e\u4f8b\uff0c\u5de5\u5382\u5c31\u662f\u6784\u9020\u51fd\u6570\uff0c\u56fe\u7eb8\u5c31\u662f\u539f\u578b\uff08Prototype\uff09\n\/\/VH\uff1a\u6784\u9020\u51fd\u6570\u6ca1\u6709return\u5374\u53ef\u4ee5\u6709\u8fd4\u56de\u503c\u7684\u51fd\u6570\u3002\n\n\/\/\u6784\u9020\u51fd\u6570\u7684\u9996\u5b57\u6bcd\u8981\u5927\u5199\n\/\/\u7528\u6784\u9020\u51fd\u6570\u6784\u9020\u7684\u5b9e\u4f8b\u7684\u5c5e\u6027\u5c31\u662f\u6784\u9020\u51fd\u6570\u4e2d\u8fd9\u4e9bthis\u5b9a\u4e49\u7684\u5c5e\u6027\n\/\/VH:\u672c\u8282\u4e2d\u6ca1\u6709\u5728\u6784\u9020\u51fd\u6570\u4e2d\u5b9a\u4e49\u65b9\u6cd5\uff0cthis.signIn=function(){},\u8fd9\u6837\u7684\u65b9\u5f0f\u3002\u572866\u8282\u539f\u578b\u6709\u4f8b\u5b50\u3002\n\n\/\/&quot;\u54ea\u4e00\u4e2a\u5458\u5de5\u6765\u4e3e\u4f8b\u5b50&quot;\uff0c\u8001\u5e08\u4e3a\u5565\u8bf4\u662f\u4e00\u4e2a\u5458\u5de5\u5462\uff1f\u5b83\u6307\u8fd9\u4e2a\u6784\u9020\u51fd\u6570\u8fd8\u662f\u4f8b\u5b50\u4e2d\u9760\u540e\u51fa\u73b0\u7684\u5b9e\u4f8b\u5462\uff1f\nfunction Employee(name,position){\n    this.name=name;\/\/\u8001\u5e08\u8fd9\u91cc\u4f7f\u7528\u4e86\u5206\u53f7,\u56e0\u4e3a\u662f\u51fd\u6570\u5185\uff0c\u4e0d\u662f\u5bf9\u8c61\u5185\uff0c\u867d\u7136\u662f\u6784\u9020\u51fd\u6570\u3002\n    this.position = position;\/\/\u8001\u5e08\u8fd9\u91cc\u4f7f\u7528\u4e86\u5206\u53f7,\u56e0\u4e3a\u662f\u51fd\u6570\u5185\uff0c\u4e0d\u662f\u5bf9\u8c61\u5185\uff0c\u867d\u7136\u662f\u6784\u9020\u51fd\u6570\u3002\n}\n\/\/\nvar emp1= new Employee(&#039;\u5cf0\u534e&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nconsole.log(emp1);\n\nvar emp2= new Employee(&#039;\u5f20\u4e09&#039;,&#039;\u540e\u7aef\u5de5\u7a0b\u5e08&#039;);\nconsole.log(emp2);\n\/*\nEmployee {name: &quot;\u5cf0\u534e&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;}\nname: &quot;\u5cf0\u534e&quot;\nposition: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n__proto__: Object\n\nEmployee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u540e\u7aef\u5de5\u7a0b\u5e08&quot;}\nname: &quot;\u5f20\u4e09&quot;\nposition: &quot;\u540e\u7aef\u5de5\u7a0b\u5e08&quot;\n__proto__: Object\n*\/\n\n\/** *\/\n\n\/*P64-this\u5173\u952e\u5b57\n\/\/this\u6307\u7684\u662f\u5b9e\u4f8b\u5bf9\u8c61\u672c\u8eab\uff0c\u53ef\u4ee5\u7528\u5b83\u8bbf\u95ee\u81ea\u8eab\u7684\u5c5e\u6027\n\/\/\u6784\u9020\u51fd\u6570\u4e0d\u662f\u5b9e\u4f8b\uff0c\u4f46\u662f\u89c4\u5b9a\uff0cthis.\u5c5e\u6027\u8fd9\u6837\u7684\u8bed\u6cd5\u662f\u5b9a\u4e49\u6784\u9020\u51fd\u6570\u521b\u5efa\u7684\u5b9e\u4f8b\u62e5\u6709\u7684\u5c5e\u6027\u3002\n\/\/\u5b57\u9762\u503c\u521b\u5efa\u7684\u5b9e\u4f8b\uff0c\u5c31\u5f88\u5bb9\u6613\u7406\u89e3this\n\nvar emp3={\n    name:&#039;\u674e\u56db&#039;,\n    name2:&#039;\u674e\u4e94&#039;,\n    position:&#039;\u540e\u7aef\u5de5\u7a0b\u5e08&#039;,\n    signIn:function(){\n        console.log(this.name+&#039;\u4e0a\u73ed\u6253\u5361&#039;);\/\/\u6807\u53f7207\n    },\n};\n\nemp3.signIn();\/\/\u6807\u53f7207\uff1a\u4e0a\u73ed\u6253\u5361\n\n\/\/\u540e\u6765\u65b0\u589e\u65b9\u6cd5\uff0c\u4e5f\u662f\u53ef\u4ee5\u4f7f\u7528this\u6765\u83b7\u53d6\u81ea\u8eab\u7684\u5c5e\u6027\u503c\n\/\/\u8fd9\u65f6this\u6307\u4ee3\u7684\u662f\u5bf9\u8c61\u672c\u8eabemp3\n\nemp3.goToWork = function (){\n    console.log(this.name2+&#039;\u53bb\u4e0a\u73ed&#039;);\/\/\u6807\u53f7215\n};\nemp3.goToWork();\/\/\u6807\u53f7215\uff1a\u674e\u56db\u53bb\u4e0a\u73ed\n\n\/\/\u65b0\u589e\u65b9\u6cd5\u7684\u65f6\u5019\uff0c\u5982\u679c\u4f7f\u7528\u7bad\u5934\u51fd\u6570\u7684\u8bdd\uff0c\u51fd\u6570\u4f53\u5185\u7684this\u4e0d\u662f\u6307\u5411\u5bf9\u8c61\u672c\u8eab\uff0c\u800c\u662fwindow\u5bf9\u8c61\n\/\/window\u5bf9\u8c61\u662f\u6d4f\u89c8\u5668\u5185\u7f6e\u7684\uff0c\u7bad\u5934\u51fd\u6570\u4e2dthis\u6307\u5411\u5305\u88f9\u5b83\u7684\u4f5c\u7528\u57df\u7684this\u5bf9\u8c61\uff0c\n\/\/\u8fd9\u91cc\u6ca1\u6709\u5305\u88f9\u5b83\u7684\u4f5c\u7528\u57df\uff0c\u6240\u4ee5\u6307\u5411global\u5168\u5c40\u7684this\uff0c\u6d4f\u89c8\u5668\u73af\u5883\u4e0b\u5c31\u662fwindow\u5bf9\u8c61\n\/\/\u5982\u679c\u7bad\u5934\u51fd\u6570\u5b9a\u4e49\u5728\u6784\u9020\u51fd\u6570\u5185\u90e8\uff0c\u90a3\u4e48\u5c31\u662f\u6784\u9020\u51fd\u6570\u91cc\u7684this\uff0c\u4e5f\u5c31\u662f\u5bf9\u8c61\u81ea\u8eab\nemp3.getOffWork = ()=&gt;{\n    console.log(this.name+&#039;\u4e0b\u73ed&#039;);\/\/\u6807\u53f7225\n    console.log(this);\/\/Window\u00a0{window: Window, self: Window, document: document, name: &quot;&quot;, location: Location,\u00a0\u2026}\n};\nemp3.getOffWork();\/\/\u6807\u53f7225\uff1a\u4e0b\u73ed\/\/\u6ca1\u6709\u663e\u793a\u674e\u56db\n\n\/\/\u6ce8\u610f\u8fd9\u4e2a\u4f8b\u5b50\u6d4b\u8bd5\u7684\u65f6\u5019\uff0c\u51fa\u73b0\u8bfb\u51faname\u503c\uff0c\u6216\u8005\u662fundefined\u4e0b\u73ed\u7684\u60c5\u51b5\uff0c\n\/\/this.name\u4f3c\u4e4e\u4fdd\u7559\u4e86\u2018\u674e\u56db\u2019\u7684\u503c\uff0c\u4fee\u6539\u5bf9\u8c61\u2018\u674e\u56db1\u2019\u524d\u9762\u4f8b\u5b50\u7684this.name\u4e0d\u6539\u53d8\u3002\n\/\/\u5173\u95ed\u7f51\u9875\uff0c\u91cd\u65b0\u6253\u5f00\uff0c\u5c31\u6062\u590d\u6b63\u5e38\u4e86\u3002\n\/** *\/\n\n\/*\u5728\u6784\u9020\u51fd\u6570\u91cc\u4f7f\u7528\u7bad\u5934\u51fd\u6570*\n\/\/\u5982\u679c\u7bad\u5934\u51fd\u6570\u5b9a\u4e49\u5728\u6784\u9020\u51fd\u6570\u5185\u90e8\uff0c\u90a3\u4e48\u5c31\u662f\u6784\u9020\u51fd\u6570\u91cc\u7684this\uff0c\u4e5f\u5c31\u662f\u5bf9\u8c61\u81ea\u8eab\n\/\/\u6ce8\u610f\uff1a\u7bad\u5934\u51fd\u6570\u4e0d\u9002\u5408\u4f5c\u4e3a\u5bf9\u8c61\u65b9\u6cd5\u7684\u5b9a\u4e49\uff0c\u4e00\u5b9a\u8981\u4f7f\u7528\u6b63\u5e38\u65b9\u6cd5function (){}\nfunction Employee(name,position){\n    this.name=name;\n    this.position = position;\n    this.signIn=()=&gt;{\n        console.log(this.name+&#039;\u53bb\u4e0a\u73ed&#039;);\/\/\u6807\u53f7245\n    };\n}\nvar emp4=new Employee(&#039;\u738b\u4e94&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nemp4.signIn();\/\/\u6807\u53f7245\uff1a\u738b\u4e94\u53bb\u4e0a\u73ed\/\/\u80fd\u591f\u8bbf\u95ee\u5458\u5de5\u7684\u540d\u5b57\uff0c\n\/* *\/\n\n\/*P65-getters\u548csetters\n\/\/\u53ef\u4ee5\u5199\u4e00\u4e9b\u903b\u8f91\u628a\u503c\u52a0\u5de5\u540e\u8fd4\u56de\u51fa\u6765\uff08\u6216\u8d4b\u7ed9\u53e6\u4e00\u4e2a\u5c5e\u6027\uff09\n\/\/VH:\u7ecf\u8fc7\u5b66\u4e60\uff0c\u7406\u89e3\u4e3a\u539f\u6709\u5c5e\u6027\u4e3a\u539f\u6599\u7684\u73b0\u52a0\u5de5\u5c5e\u6027\uff08\u6307getter\uff09\u6216\u73b0\u5904\u7406\u5c5e\u6027\uff08\u6307setter\uff09\uff0c\u8fd9\u4e2a\u5c5e\u6027\u6709\u81ea\u5df1\u7684\u540d\u5b57\u5e76\u4e0d\u662fsetter\u6216setter\u3002\n\/\/setter\u7684\u53c2\u6570\u53ea\u80fd\u6709\u4e00\u4e2a\u3002set fullname(funllname){},\u8bed\u53e5\u4e2d(fullname)\u53c2\u6570\u53ea\u80fd\u6709\u4e00\u4e2a\n\/\/\u53ea\u6709getter\u662f\u53ea\u8bfb\uff0c\u5199\u4e86setter\u5c31\u662f\u53ef\u4ee5\u4fee\u6539\u3002\nvar person ={\n    firstName:&#039;\u4e09&#039;,\n    lastName:&#039;\u5f20&#039;,\n    get fullName(){\n        return this.lastName+this.firstName;\n    },\n    \/\/\u8fd9\u91cc\u5199set fullName(),\u4f7ffullName\u6709\u5199\u7684\u5c5e\u6027\uff08\u80fd\u529b\u5427\uff09\n    set fullName(fullName){\/\/\u8bed\u53e5\u4e2d(fullname)\u53c2\u6570\u53ea\u80fd\u6709\u4e00\u4e2a\n        let [lastName,firstName]=fullName.split(&#039;\uff0c&#039;);\n        this.lastName = lastName;\n        this.firstName = firstName;\n        \/\/\u4e0a\u9762\u8fd9\u4e48\u5199\u4e0d\u4f1a\u641e\u9519\u4e48\uff1f\u54ea\u4e2a\u662f\u53c2\u6570\uff0c\u54ea\u4e2a\u662f\u5bf9\u8c61\u5c5e\u6027\uff1f\n        \/\/\u5e26this\u7684\u662f\u5bf9\u8c61\u5c5e\u6027\uff0c\u4e0d\u5e26\u7684\u5c31\u662f\u53c2\u6570\n    },\n};\n\n\/\/\u6ce8\u610f\u8fd9\u91cc\u8c03\u7528\u4e0d\u662f\u51fd\u6570\uff0c\u4e0d\u5e26(),\u800c\u662f\u50cf\u5c5e\u6027\u4e00\u6837\u83b7\u53d6\u5b83\nconsole.log(person.fullName);\/\/\u5f20\u4e09\n\/\/\u5199\u5165\u65b9\u5f0f\uff0c\u4e0d\u662f\u4ee5\u53c2\u6570\u4f20\u5165\u51fd\u6570\u65b9\u5f0f\u201c\uff08\u53c2\u6570\uff09\u201d\uff0c\u800c\u662f\u50cf\u5c5e\u6027\u4e00\u6837\u76f4\u63a5\u8d4b\u503c\u65b9\u5f0f\nperson.fullName=&#039;\u674e\uff0c\u56db&#039;;\nconsole.log(person.fullName);\/\/\u674e\u56db\nconsole.log(person.lastName,person.firstName);\/\/\u674e \u56db\n\n\/\/\u5982\u679c\u662f\u901a\u8fc7\u6784\u9020\u51fd\u6570\u521b\u5efa\u7684\u5bf9\u8c61\uff0c\u540e\u671f\u4e5f\u53ef\u4ee5\u7ed9\u5bf9\u8c61\u6dfb\u52a0getter\u548csetter\n\/\/Object.definedProperty()\n\/\/\u5bf9\u8c61\uff0c\u5c5e\u6027\u540d\u5b57\uff0c\u5177\u4f53\u51fd\u6570\u7528{}\uff0c\u91cc\u9762\u5199setter\u548cgetter\u65b9\u6cd5\uff0c\u548c\u4e0a\u9762\u4e0d\u540c\u3002\u548c\u5b57\u9762\u503c\u5b9a\u4e49\u5bf9\u8c61\u7684\u65b9\u6cd5\u5f88\u50cf\uff0c\u4f46\u4e5f\u4e0d\u540c\u3002\n\/\/get: function(){}\n\/\/set: function(\u53c2\u6570\u540d){}\nfunction Employee2(name,position){\n    this.name=name;\n    this.position = position;\n}\n\nvar emp5= new Employee2(&#039;\u8d75\u516d&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nObject.defineProperty(emp5,&#039;info&#039;,{\/\/\/\/\u8fd9\u91cc\u7684info\u662f\u662fsetter\u548cgetter\u7684\u540d\u5b57\u548c\u4e0b\u9762\u7684set:function (info)\u4e2d\u7684info\u662f\u51fd\u6570\u53c2\u6570\uff0c\u4e8c\u8005\u4e0d\u662f\u4e00\u4e2a\u3002\n    get:function(){\n        return this.name+&#039; &#039;+this.position;\n    },\n    set:function (info){\/\/\u8fd9\u91cc\u7684info\u662f\u51fd\u6570\u53c2\u6570\u548c\u4e0a\u9762\u7684emp5\u540e\u9762\u7684info\u662fsetter\u548cgetter\u7684\u540d\u5b57\uff0c\u4e8c\u8005\u4e0d\u662f\u4e00\u4e2a\u3002\n        let [name,position]=info.split(&#039; &#039;);\n        this.name=name;\n        this.position = position;\n    }\n});\n\nconsole.log(emp5.info);\/\/\u8d75\u516d \u524d\u7aef\u5de5\u7a0b\u5e08\nemp5.info=&#039;\u8d75\u4e03 \u540e\u7aef\u5de5\u7a0b\u5e08&#039;;\nconsole.log(emp5.name);\/\/\u8d75\u4e03\nconsole.log(emp5.position);\/\/\u540e\u7aef\u5de5\u7a0b\u5e08\n\/** *\/\n\n\/*P66-\u5bf9\u8c61-\u539f\u578b\n\/\/JS\u7684\u5bf9\u8c61\u548c\u51fd\u6570\u90fd\u6709\u539f\u578b\u3002\n\/\/\u539f\u6765\u8bf4\u8fc7\uff0c\u539f\u578b\u53ef\u4ee5\u60f3\u8c61\u6210\u56fe\u7eb8\n\/\/\u5982\u679c\u4e00\u4e2a\u51fd\u6570\u662f\u6784\u9020\u51fd\u6570\uff0c\u90a3\u4e48\u5b83new\u51fa\u5b9e\u4f8b\u5c31\u4f1a\u7ee7\u627f\u5b83\u7684\u539f\u578b\n\/\/var Employee = function(age,position){\/\/\u8001\u5e08\u662f\u5199\u6210function Employee(age,position){}\u7684\u6837\u5f0f\uff0c\nfunction Employee(name,position){\n    this.name = name;\n    this.position = position;\n    this.signIn = function(){\n        console.log(this.name+&#039;\u6253\u5361&#039;);\n    };\n};\n\nvar emp1 = new Employee(&#039;\u5f20\u4e09&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nvar emp2 = new Employee(&#039;\u674e\u56db&#039;,&#039;\u540e\u7aef\u5de5\u7a0b\u5e08&#039;);\n\nconsole.log(emp1);\/\/\u6807\u8bb016\nconsole.log(emp2);\/\/\u6807\u8bb017\n\/\/\u8001\u5e08\u8bf4\uff0c\u6253\u5f00\u540e\n\/\/output\uff1a\/\/\u6807\u8bb016\u7684\u6253\u5370\u7ed3\u679c\uff0c\u6807\u8bb017\u7c7b\u4f3c\u4e0d\u518d\u91cd\u590d\n\/\/ Employee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, signIn: \u0192}\n\/\/     name: &quot;\u5f20\u4e09&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     signIn: \u0192 ()\n\/\/     __proto__: Object\/\/\u8001\u5e08\u8bf4\u8fd9\u91cc\u5c31\u662f\u539f\u578b\u662fobject\uff0c\u662f\u5bf9\u8c61\u7c7b\u578b\u7684\/\/\uff1f\u539f\u578b\u7684\u7c7b\u578b\uff1f\u6709\u5f88\u591a\u79cd\u5417?\n\/\/ \/\/\u5982\u679c\u518d\u5c55\u5f00\uff0c\u5c31\u53d1\u73b0\u6700\u540e\u4e00\u9879\u8fd8\u6709\u539f\u578b\uff0c\u662f\u4e0a\u7ea7\u539f\u578b\uff0c\u8001\u5e08\u8bf4\u540e\u9762\u5c0f\u8282\u539f\u578b\u94fe\u4f1a\u8bb2\u5230\n\/\/     __proto__:\n\/\/         constructor: \u0192 Employee(name,position)\/\/\u8001\u5e08\u8bf4\uff1a\u76ee\u524d\u8fd9\u4e2a__proto__\u53ea\u67091\u4e2a(\u5185\u5bb9)\uff0c\u5c31\u662f\u8fd9\u4e2aconstructor\u5c31\u662f\u4e0a\u9762\u5b9a\u4e49\u7684\u6784\u9020\u51fd\u6570\u3010\u8001\u5e08\u8bf4\u30113\u4e2a\u5b57\u51fa\u73b0\uff0c\u8868\u660e\u6211\u5e76\u6ca1\u6709\u7406\u89e3\uff0c\u54c8\u54c8\u54c8\n\/\/         __proto__: Object\/\/\u8001\u5e08\u8bf4\uff1a\u8fd9\u91cc\u8fd8\u6709\u4e00\u4e2a\u539f\u578b\uff0c\u662f\u4e0a\u7ea7\u539f\u578b\uff0c\u8001\u5e08\u8bf4\u539f\u578b\u94fe\u4f1a\u8bb2\u5230\n\n\/\/\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\u589e\u52a0\u5c5e\u6027\n\/\/\u5982\u679c\u7ed9\u539f\u578b\u589e\u52a0\u65b0\u7684\u5c5e\u6027\uff0c\u90a3\u4e48emp1\u548cemp2\u90fd\u53ef\u4ee5\u7ee7\u627f\u8fd9\u4e2a\u5c5e\u6027\n\/\/\u4f7f\u7528.prototype\u5c5e\u6027\u67e5\u770b\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\uff08prototype\uff09\uff0c\/\/\u8fd9\u91cc\u8001\u5e08\u8bf4\u7684\u662f\u51fd\u6570\u624d\u6709prototype\u5c5e\u6027\uff0c\u539f\u672c\u5e94\u8be5\u662f\u6784\u9020\u51fd\u6570\uff0c\u540e\u671f\u6d88\u97f3\uff0c\u6709\u6b8b\u7559\uff0c\u89c1\u5e95\u90e8\u666e\u901a\u51fd\u6570\u6d4b\u8bd5\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u5c5e\u6027\uff08\u67e5\u770b\u548c\u901a\u8fc7\u5b83\u6dfb\u52a0\u65b0\u5c5e\u6027\uff09\u3002\n\/\/\u5c31\u662f\u4e0a\u9762\u4f8b\u5b50\uff0c\u6253\u5370\u7ed3\u679c\u4e2d__proto__\u6307\u5411\u7684\u5bf9\u8c61\uff08\u8001\u5e08\u8bf4\u5bf9\u8c61\u5e94\u8be5\u662f\u5185\u5bb9\u7684\u540c\u4e49\u8bcd\uff0c\u4e0d\u662fJS\u4e2d\u7684\u5bf9\u8c61\u4e00\u8bcd\uff09\n\nconsole.log(Employee.prototype);\/\/{constructor: \u0192}\/\/\u8fd9\u6837\u53ef\u4ee5\u76f4\u63a5\u67e5\u770b\uff1f\n\/\/output\uff1a\u4e0e\u4e0a\u4f8b\u4e2d\u7684\u4e0a\u7ea7\u539f\u578b\u662f\u4e00\u6837\u7684,\u6253\u5370\u7ed3\u679c\u5982\u4e0b\n\/\/ {constructor: \u0192}\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\n\/\/VH\uff1a\u6d4b\u8bd5\u6253\u5370Employee\u548c\u5b83\u7684prototype\u6bd4\u8f83\n\/\/\u6253\u5370\u7ed3\u679c\u4ec5\u4ec5\u662f\u51fd\u6570\u4f53,\u4e0d\u80fd\u901a\u8fc7\u5b9e\u4f8b\u90a3\u6837\u70b9\u51fb\u67e5\u770b\u4e48\uff1f\nconsole.log(Employee);\/\/\n\/\/output:\n\/\/ \u0192 Employee(name,position){\n\/\/     this.name = name;\n\/\/     this.position = position;\n\/\/     this.signIn = function(){\n\/\/         console.log(this.name+&#039;\u6253\u5361&#039;);\n\/\/     };\n\/\/ }\n\n\/\/\u7ed9\u6784\u9020\u51fd\u6570\u7684prototype\uff08\u539f\u578b\uff09\u6dfb\u52a0\u65b0\u5c5e\u6027\u548c\u65b9\u6cd5\u7684\u65f6\u5019\uff0c\n\/\/\u5b83\u521b\u5efa\u7684\u6240\u6709\u7684\u5bf9\u8c61\uff0c\u90fd\u4f1a\u81ea\u52a8\u7ee7\u627f\u8fd9\u4e2a\u5c5e\u6027\uff0c\u65e0\u9700\u91cd\u65b0\u5b9a\u4e49emp1\u548cemp2\nEmployee.prototype.age = 20;\/\/\u6ca1\u6709\u5c31\u65b0\u5efa\uff0c\u6709\u7684\u8bdd\u662f\u66f4\u65b0\nconsole.log(emp1.age);\/\/20\nconsole.log(emp2.age);\/\/20\n\nEmployee.prototype.printInfo = function(){\n    console.log(this.name, this.age, this.position);\n};\n\nemp1.printInfo();\/\/\u5f20\u4e09 20 \u524d\u7aef\u5de5\u7a0b\u5e08\nemp2.printInfo();\/\/\u674e\u56db 20 \u540e\u7aef\u5de5\u7a0b\u5e08\n\n\/\/\u8bbf\u95ee\u5bf9\u8c61\u7684prototype\u539f\u578b\n\/\/\u4f7f\u7528.__proto__\u7684\u65b9\u5f0f\n\/\/\u5b83\u7684prototype\u5c31\u662f\u6784\u9020\u51fd\u6570\u7684prototype\nconsole.log(emp1.__proto__);\/\/\u6ce8\u610f\uff0c\u8fd9\u91cc\u662f2\u4e2a\u4e0b\u5212\u7ebf__\u770b\u4e0a\u53bb\u6bd4\u8f83\u957f\n\/\/\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u591a\u51faage\u548cprintInfo,2\u4e2a\u5c5e\u6027\u662f\u81ea\u52a8\u7ee7\u627f\u3002\n\/\/output:\u6253\u5370\u7ed3\u679c\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\nconsole.log(Employee.prototype);\nconsole.log(emp1.__proto__ === Employee.prototype);\n\/\/output:\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\/\/\u53e6\u4e00\u53e5\u7684\u7ed3\u679c\uff1a\n\/\/ true\/\/\u8bf4\u660e2\u8005\u5b8c\u5168\u76f8\u540c\n\n\/\/Object.getProtoTypeOf()\u67e5\u770b\u539f\u578b\nconsole.log(Object.getPrototypeOf(emp2));\n\/\/output:\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\n\/\/VH\uff1a\u6d4b\u8bd5\uff0c\u4e00\u822c\u51fd\u6570\u7684prototype\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u4e00\u822c\u51fd\u6570\nfunction testProtoTypeOfFunction(){\n    console.log(&#039;\u6d4b\u8bd5\u4e00\u822c\u51fd\u6570\u7684prototype&#039;);\n}\n\/\/\u5f00\u59cb\u6d4b\u8bd5\uff1a\n\/\/\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u5bf9\u4e8e\u5bf9\u8c61\u5b9e\u4f8b\u6765\u8bf4\uff0cObject.getPrototypeOf\u548c.prototype\u7ed3\u679c\u4e00\u6837\n\/\/\u4f46\u662f\uff0c\u5bf9\u4e8e\u51fd\u6570\u6765\u8bf4\uff0cObject.getPrototypeOf\u548c.prototype\u7ed3\u679c\u4e0d\u4e00\u6837\nconsole.log(Object.getPrototypeOf(testProtoTypeOfFunction));\nconsole.log(Object.getPrototypeOf(Employee));\nconsole.log(testProtoTypeOfFunction.prototype);\nconsole.log(Employee.prototype);\n\/\/\u524d\u4e8c\u53e5\u7684\u7ed3\u679c\uff1a\n\/\/\u0192 () { [native code] }\n\/\/\u0192 () { [native code] }\n\/\/\u7b2c\u4e09\u53e5\u7684\u7ed3\u679c\uff1a\n\/\/ {constructor: \u0192}\n\/\/     constructor: \u0192 testProtoTypeOfFunction()\n\/\/     __proto__: Object\n\/\/\u7b2c\u56db\u53e5\u7684\u7ed3\u679c\uff1a\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\n\/\/VH\uff1a\u6d4b\u8bd5\u51fd\u6570\u7684__proto__\u548c\u5bf9\u8c61\u7684prototype\n\/\/\u7ed3\u8bba\u662f\u8001\u5e08\u6ca1\u6709\u9a97\u4eba\uff0c\u54c8\u54c8\u54c8\nconsole.log(Employee.__proto__);\/\/\u0192 () { [native code] }\nconsole.log(testProtoTypeOfFunction.__proto__);\/\/\u0192 () { [native code] }\nconsole.log(manager.prototype);\/\/undefined\n\n\/\/VH\uff1a\u4e0b\u9762\u6d4b\u8bd5\u901a\u8fc7prototype\u7ed9\u666e\u901a\u51fd\u6570\u6dfb\u52a0\u5c5e\u6027\uff0c\u53ef\u4ee5\u6dfb\u52a0\uff0c\u666e\u901a\u51fd\u6570\u4e5f\u6709prototype\u5c5e\u6027\n\/\/\u8bf4\u660e\uff0c\u4e0a\u9762\u8001\u5e08\u7b2c\u4e00\u6b21\u8bb2\u51fd\u6570.prototype\u7684\u65f6\u5019\uff0c\u8bf4\u5f97\u4e0d\u6e05\u695a\u7684\u5730\u65b9\uff0c\u5e94\u8be5\u662f\u540e\u671f\u6d88\u97f3\uff0c\u628a\u201c\u6784\u9020\u201d\u53bb\u6389\uff0c\u4f46\u7559\u4e86\u4e00\u4e9b\u58f0\u97f3\ntestProtoTypeOfFunction.prototype.age = 35;\nconsole.log(testProtoTypeOfFunction.prototype)\n\/\/ {age: 35, constructor: \u0192}\n\/\/     age: 35\n\/\/     constructor: \u0192 testProtoTypeOfFunction()\n\/\/     __proto__: Object\n\n\/\/\u3010\u6d4b\u8bd5\u7ed3\u8bba\u3011\u51fd\u6570\u90fd\u539f\u578b\u662f\u4e2a\u5bf9\u8c61\uff0c\n\/\/\u91cc\u9762\u67092\u4e2a\u5c5e\u6027\uff1a\n\/\/\u7b2c\u4e00\u4e2a\uff1aconstructior\uff08\u503c\u662f\u81ea\u5df1\uff09\uff0c\n\/\/\u7b2c\u4e8c\u4e2a\uff1a__prototype__\u662f\u81ea\u5df1\u7684\u539f\u578b\n\/\/\u7efc\u5408\u4e0a\u9762\u7684\u8bf4\u6cd5\uff1a\n\/\/\u5bf9\u8c61\u5b9e\u4f8b\u7684\u539f\u578b\u662f\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\u3002\n\/** *\/\n\n\/*P67-\u5bf9\u8c61-Object-create\n\/\/Object.create()\u53ef\u4ee5\u8ba9\u5bf9\u8c61\u7ee7\u627f\u53e6\u4e00\u4e2a\u5bf9\u8c61\n\/\/\u65b0\u5bf9\u8c61\u62e5\u6709\u88ab\u7ee7\u627f\u5bf9\u8c61\u7684\u6240\u6709\u5c5e\u6027\n\/\/\u5e76\u4e14\u8fd8\u53ef\u4ee5\u7528\u81ea\u5df1\u7279\u6709\u7684\u5c5e\u6027\n\n\/\/\u6bd4\u5982\u4eba\uff0c\u8eaf\u5e72\u548c\u56db\u80a2\uff0c\u4f46\u662f\u90fd\u6709\u81ea\u5df1\u7684\u540d\u5b57\n\nfunction Employee(name,position){\n    this.name = name;\n    this.position = position;\n    this.signIn = function(){\n        console.log(this.name+&#039;\u6253\u5361&#039;);\n    };\n};\nvar emp1 = new Employee(&#039;\u5f20\u4e09&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nvar emp2 = new Employee(&#039;\u674e\u56db&#039;,&#039;\u540e\u7aef\u5de5\u7a0b\u5e08&#039;);\nEmployee.prototype.age = 20;\nEmployee.prototype.printInfo = function(){\n    console.log(this.name, this.age, this.position);\n};\n\n\/\/\u76f4\u63a5\u6253\u5370\u5bf9\u8c61\u6ca1\u6709\u65b0\u589e\u7684\u5c5e\u6027\uff0c\n\/\/\u6253\u5370\u7ed3\u679c\u67e5\u770b\uff0c\u7ee7\u627f\u7684\u5c5e\u6027\u6ca1\u6709\u6253\u5370\u51fa\u6765,\u7ee7\u627f\u7684\u539f\u578b\u7684\u5c5e\u6027\u662f\u5728\u539f\u578b\u7684\u5c42\u7ea7__prototype__\u91cc\u9762\nconsole.log(emp1);\/\/Employee\u00a0{name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, signIn: \u0192}\n\/\/output\uff1a\n\/\/ Employee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, signIn: \u0192}\n\/\/     name: &quot;\u5f20\u4e09&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     signIn: \u0192 ()\n\/\/     __proto__:\/\/\u5c55\u5f00\n\/\/         age: 20\n\/\/         printInfo: \u0192 ()\n\/\/         constructor: \u0192 Employee(name,position)\n\/\/         __proto__: Object\n\/\/output-end\u7ed3\u675f\n\n\/\/\u4f7f\u7528for in\u5373\u53ef\u67e5\u770b\u6240\u6709\u7684\u5c5e\u6027\uff08\u542b\u539f\u578b\u7684\uff09\n\/\/\u867d\u7136\u8001\u5e08\u540d\u5b57\u58f0\u660ekey\uff0c\u4f46\u6211\u9047\u5230\u62a5\u9519\uff0c\n\/\/\u5728\u4e4b\u524d\u7684\u8bfe\u7a0b\u91cc\u9762\u6ca1\u6709\u8981\u6c42\u58f0\u660ekey\uff0c\u8be6\u7ec6\u60c5\u51b5\u53c2\u8003P61-\u5bf9\u8c61-\u904d\u5386\n\/\/\u4f7f\u7528for(let key in emp1),\u5728()\u4e2d\u58f0\u660ekey\uff0c\u4ee5\u540e\u4f7f\u7528\u8fd9\u4e2a\u65b9\u5f0f\nfor(let key in emp1){\n    console.log(key);\n}\n\/\/output:\n\/\/ index.js:26 name\n\/\/ index.js:26 position\n\/\/ index.js:26 signIn\n\/\/ index.js:26 age\n\/\/ index.js:26 printInfo\n\n\/\/VH\uff1a\u590d\u4e60\u4e00\u4e0b\u4f7f\u7528Object.keys\uff0c\u8fd4\u56de\u6570\u7ec4,\u4e5f\u53ea\u662f\u672c\u8eab\u7684\u5c5e\u6027\uff0c\u6ca1\u6709\u539f\u578b\u7684\nconsole.log(Object.keys(emp1));\/\/(3)\u00a0[&quot;name&quot;, &quot;position&quot;, &quot;signIn&quot;]\n\nvar manager = Object.create(emp1);\nconsole.log(manager);\/\/\u672c\u884c\u6807\u8bb055\n\/\/output:\/\/\u6807\u8bb0521\n\/\/ Employee {}\n\/\/     __proto__: Employee\/\/\u5c55\u5f00\u5c31\u662f\u4e0b\u9762\u5185\u5bb9\n\/\/         name: &quot;\u5f20\u4e09&quot;\n\/\/         position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/         signIn: \u0192 ()\n\/\/         __proto__: Object\n\/\/end\n\n\/\/VH\uff1a\u4e0b\u9762\u662f\u540e\u9762\u5b66\u4e60\u4e4b\u540e\u56de\u6765\u7684\u6d4b\u8bd5\uff0c\u672c\u884c\u6807\u8bb065\u3010\u8fd9\u53e5\u8bdd\u7684\u610f\u601d\u5e94\u8be5\u662f\uff1a\/\/VH\uff1a\u4e0b\u9762\u7684\u6807\u8bb0535\u6253\u5370\u7ed3\u679c\u662f\u540e\u9762\u589e\u52a0\u4e86\u6807\u8bb0564\u548c\u6807\u8bb0565\u8bed\u53e5\u540e\uff0c\u5c45\u7136\u5f71\u54cd\u5230\u8fd9\u91cc\u3002\u548c\u6ca1\u6709\u4e0b\u97622\u4e2a\u8bed\u53e5\u65f6\u6253\u5370\u7ed3\u679c\u6807\u8bb0521\u4e0d\u540c\uff08\u590d\u4e60\u65f6\u589e\u52a0\u8fd9\u53e5\u8bf4\u660e\uff09\u3011\n\/\/\u3010\u6d4b\u8bd5\u8fd9\u53e5\u65f6\uff0c\u907f\u514d\u5e72\u6270\uff0c\u9700\u8981\u6ce8\u91ca\u540e\u9762\u7684manager.name=&#039;\u674e\u56db&#039;;manager.position=&#039;\u7ecf\u7406&#039;;\u3011\u3010\u9700\u8981\u5f97\u5230\u4e0a\u9762\u7684\u6253\u5370\u7ed3\u679c\u6807\u8bb0521\uff0c\u9700\u8981\u5220\u9664\u6807\u8bb0564\u548c\u6807\u8bb0565\uff08\u590d\u4e60\u65f6\u589e\u52a0\u8fd9\u53e5\u8bf4\u660e\uff09\u3011\n\/\/\u4f46\u662f\u8fd9\u884c\u540e\u9762\u5982\u679c\u6709\u589e\u52a0\u4e86\u81ea\u5df1\u7684\u5c5e\u6027\u7684\u4ee3\u7801\uff0c\u6bd4\u5982 manager.name=&#039;\u674e\u56db&#039;;\u3010\u6307\u6807\u8bb0564\u548c\u6807\u8bb0565\u8fd9\u6837\u7684\u53e5\u5b50\u3011\n\/\/\u90a3\u4e48\u8fd9\u91cc\u7684\u8f93\u51fa\u4f1a\u53d8\uff0c\u4e5f\u4f1a\u8ddf\u7740\u663e\u793a\u81ea\u5df1\u7684\u5c5e\u6027name: &quot;\u674e\u56db&quot;\u3010\u6307\u4e0b\u9762\u6253\u5370\u7ed3\u679c\u6807\u8bb0535\u548c\u6253\u5370\u7ed3\u679c\u6807\u8bb0521\u4e0d\u540c\uff0c\u591a\u4e86name\u548cposition\u5c5e\u6027\u548c\u503c\u3011\n\/\/\u4f46\u662f\uff0c\u663e\u793a\u7684\u65f6\u5019\u7b2c\u4e00\u884c\uff0c\u8fd8\u662fEmployee{},{}\u5185\u662f\u7a7a\uff0c\u5bf9\u6bd4\u540e\u9762\u7684\u8f93\u51faEmployee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\u3010\u6807\u8bb0535\uff0c521\u7b2c\u4e00\u884c\u548c\u6807\u8bb0571\u7684\u7b2c\u4e00\u884c\u4e0d\u540c\u3011\n\/\/output\/\/\u6807\u8bb0535\n\/\/ Employee {}\n\/\/     name: &quot;\u674e\u56db&quot;\n\/\/     position: &quot;\u7ecf\u7406&quot;\n\/\/     __proto__: Employee\n\/\/         name: &quot;\u5f20\u4e09&quot;\n\/\/         position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/         signIn: \u0192 ()\n\/\/         __proto__: Object\n\/\/end\/\/\u3010\u4ec0\u4e48\u539f\u56e0\u5462\uff1fmanager\u7ee7\u627f\u81ea\u5bf9\u8c61emp1,emp1\u539f\u6765\u6709name\u548cpostion,\u7ee7\u627f\u540e\uff0c\u81ea\u5df1\u91cd\u65b0\u8d4b\u503c\uff0c\u90a3\u4e48\u4f1a\u9020\u6210\u524d\u9762\u8c03\u7528\u8fd9\u4e2a\u5c5e\u6027\u65f6\u662f\u81ea\u5df1\u7684\u65b0\u503c\uff0c\u4e0d\u662f\u7ee7\u627f\u7684\u503c\u3011\n\n\/\/VH\uff1a\u4e0b\u9762\u8fd9\u884c\u662f\u540e\u9762\u5b66\u4e60\u4e4b\u540e\u56de\u6765\u7684\u6d4b\u8bd5\uff0c\u672c\u884c\u6807\u8bb081\uff0c\u67e5\u770b\u6807\u8bb0118\n\/\/\u5982\u679c\u8fd9\u884c\u540e\u9762\u5982\u679c\u6709\u589e\u52a0\u4e86\u81ea\u5df1\u7684\u5c5e\u6027\u7684\u4ee3\u7801\uff0c\u6bd4\u5982 manager.name=&#039;\u674e\u56db&#039;;\n\/\/\u8fd9\u91cc\u4f7f\u7528\u4e0b\u9762\u8bed\u53e5\uff0c\u4f9d\u7136\u662f\u8fd4\u56de[]\uff0c\u8868\u793a\u65e0\u81ea\u5df1\u7684\u5c5e\u6027\n\/\/console.log(Object.getOwnPropertyNames(manager));\/\/[]\/\/\u8868\u793a\u65e0\u81ea\u5df1\u7684\u5c5e\u6027\/\/\u6807\u8bb083\n\nfor(let key in manager){\n    console.log(key);\n}\n\/\/output:\n\/\/ index.js:62 name\n\/\/ index.js:62 position\n\/\/ index.js:62 signIn\n\/\/ index.js:62 age\n\/\/ index.js:62 printInfo\n\/\/end\n\nconsole.log(manager.name);\/\/\u5f20\u4e09\n\nmanager.name=&#039;\u674e\u56db&#039;;\/\/\u6807\u8bb0564\nmanager.position=&#039;\u7ecf\u7406&#039;;\/\/\u6807\u8bb0565\n\n\/\/\u73b0\u5728\u5c55\u5f00\u5df2\u7ecf\u53d1\u73b0\u6709\u81ea\u5df1\u7684\u5143\u7d20\u4e86\u3002\u539f\u578b\u91cc\u7684\u5143\u7d20\u8fd8\u5728\u3002\n\/\/\u73b0\u5728\u67e5\u770b\u4e0a\u9762\u6ca1\u6709\u6dfb\u52a0\u81ea\u5df1\u5143\u7d20\u524d\u7684\u6253\u5370console.log(manager)\u6807\u8bb065\u548c\u6807\u8bb055\uff0c\u867d\u7136\u4e5f\u6709\u4e86\u81ea\u5df1\u7684\u5143\u7d20\uff0c\u4f46\u662f\u533a\u522b\u5728\u7b2c\u4e00\u884c\u7684\u663e\u793a\n\/\/\u8fd8\u662fEmployee{},{}\u5185\u662f\u7a7a\uff0c\u5bf9\u6bd4\u8fd9\u91cc\u7684\u8f93\u51faEmployee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\nconsole.log(manager);\n\/\/outputs\/\/\u6807\u8bb0571\n\/\/ Employee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\n\/\/     name: &quot;\u674e\u56db&quot;\n\/\/     position: &quot;\u7ecf\u7406&quot;\n\/\/     __proto__: Employee\/\/\u5c55\u5f00\u540e\u7ed3\u679c\u5982\u4e0b\n\/\/         name: &quot;\u5f20\u4e09&quot;\n\/\/         position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/         signIn: \u0192 ()\n\/\/         __proto__: Object\n\/\/end\n\n\/\/getOwnPropertyNames()\u67e5\u770b\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u53e6\u5916\u6709\u6d4b\u8bd5\uff0c\u67e5\u770b\u6807\u8bb083\uff0c\u672c\u884c\u6807\u8bb0118\nconsole.log(Object.getOwnPropertyNames(manager));\/\/(2)\u00a0[&quot;name&quot;, &quot;position&quot;]\n\n\/\/\u4ece\u8fd9\u91cc\u5f00\u59cb\u5230\u672c\u8282\u7ed3\u675f\uff0c\u5168\u90e8\u662f\u81ea\u5df1\u6d4b\u8bd5\u7684\u4ee3\u7801\/\/\n\/\/VH\uff1a\u5c55\u5f00manager\u7684\u5c5e\u6027\n\/\/\u5206\u6790\u5f97\u5230\u5982\u4e0b\u7ed3\u6784\uff0c\u5c31\u597d\u50cf\u662f\u80cc\u4e66\uff0c\u524d\u624b\u5c31\u662f\u539f\u578b\uff0c\u524d\u524d\u624b\u5c31\u662f\u539f\u578b\u7684\u539f\u578b\u3002\n\/\/ Employee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\n\/\/  \u7ee7   name: &quot;\u674e\u56db&quot;\n\/\/  \u627f   position: &quot;\u7ecf\u7406&quot;\n\/\/  \u5b9e   __proto__: Employee\n\/\/  \u4f8b\n\/\/     \u7b2c   name: &quot;\u5f20\u4e09&quot;\n\/\/     \u4e00   position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     \u5b9e   signIn: \u0192 ()\n\/\/     \u4f8b   __proto__:\n\/\/       \u6784    age: 20\n\/\/       \u9020    printInfo: \u0192 ()\n\/\/       \u51fd     constructor: \u0192 Employee(name,position)\n\/\/       \u6570    __proto__: Object\n\/\/end\n\n\/\/\u6d4b\u8bd5manager\u540e\u540e\u624b\u8bbf\u95ee\u524d\u524d\u624b\u7684\u5c5e\u6027,\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\nconsole.log(emp1.age);\/\/20\nconsole.log(manager.age);\/\/20\n\n\/\/\u90a3\u4e48\u6211\u4eec\u6d4b\u8bd5\u6a21\u4eff\nemp1.age = 25;\nconsole.log(emp1.age);\/\/25\n\n\/\/\u8fd9\u65f6\u6253\u5370emp1\u53d1\u73b0\uff0c\u548cmanager\u589e\u52a0\u81ea\u5df1\u5c5e\u6027\u4e00\u6837\uff0cage\uff1a25\u51fa\u73b0\u5728\u4e86emp1\u7684\u5c5e\u6027\u91cc\nconsole.log(emp1);\/\/20\n\/\/output\n\/\/ Employee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, age: 25, signIn: \u0192}\n\/\/     age: 25\n\/\/     name: &quot;\u5f20\u4e09&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     signIn: \u0192 ()\n\/\/     __proto__:\n\/\/         age: 20\n\/\/         printInfo: \u0192 ()\n\/\/         constructor: \u0192 Employee(name,position)\n\/\/         __proto__: Object\n\n\/\/\u8fd9\u65f6\u6253\u5370manager\n\/\/\u53ef\u89c1\u524d\u624b\u4e2d\u51fa\u73b0age:25\u4e86\u3002\n\/\/\u81ea\u5df1\u4e5f\u7ee7\u627f\u4e86\u524d\u624b\u7684age\u7684\u503c\uff0c\u800c\u4e0d\u662f\u6700\u521d\u6784\u9020\u51fd\u6570\u7684age\uff1a20\u3002\nconsole.log(manager);\nconsole.log(manager.age);\/\/25\n\/\/output\n\/\/ Employee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\n\/\/     name: &quot;\u674e\u56db&quot;\n\/\/     position: &quot;\u7ecf\u7406&quot;\n\/\/     __proto__: Employee\n\/\/         age: 25\n\/\/         name: &quot;\u5f20\u4e09&quot;\n\/\/         position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/         signIn: \u0192 ()\n\/\/         __proto__:\n\/\/             age: 20\n\/\/             printInfo: \u0192 ()\n\/\/             constructor: \u0192 Employee(name,position)\n\/\/             __proto__: Object\n\/\/end\n\n\/\/\nemp1.printInfo();\/\/\u5f20\u4e09 25 \u524d\u7aef\u5de5\u7a0b\u5e08\/\/index.js:19,\u8fd9\u4e2a\u5c31\u6709\u70b9\u610f\u601d\u3002\u662f\u8bed\u53e5\u6240\u5728\u884c\nmanager.printInfo();\/\/\u674e\u56db 25 \u7ecf\u7406\/\/index.js:19\n\n\/\/\u90a3\u4e48\u5982\u679c\u8df3\u8fc7emp1,\u4fee\u6539printInfo(),\u90a3\u4e48emp1\u4f1a\u5982\u4f55\u5462\uff1f\nmanager.printInfo = function(){\n    console.log(this.name,this.age,this.position,&#039;\u6211\u662fmanager.printInfo\u65b0\u5b9a\u4e49&#039;);\n};\n\nemp1.printInfo();\/\/\u5f20\u4e09 25 \u524d\u7aef\u5de5\u7a0b\u5e08\/\/index.js:19,emp1.printInfo()\u7684\u8f93\u51fa\u6ca1\u6709\u53d8\nmanager.printInfo();\/\/\u674e\u56db 25 \u7ecf\u7406 \u6211\u662fmanager.printInfo\u65b0\u5b9a\u4e49\/\/index.js:183 \/\/\u8bed\u53e5\u884c\u5df2\u7ecf\u6539\u53d8\n\n\/\/VH\uff1a\u67e5\u770b\u5c5e\u6027\u5217\u8868\u4e2d\u5404\u4e2a\u9879\u76ee\u7684\u6765\u6e90\uff0c\u65b9\u5f0f\u662f\u4e0d\u4e00\u6837\u7684\u3002\n\/\/\u8001\u5e08\u8bf4\u53ea\u6709\u6784\u9020\u51fd\u6570\u6709\u8fd9\u4e2aprototype\uff08\u56e0\u4e3a\u5b83\u662f\u6700\u521d\uff0c\u4e0d\u53ef\u80fd\u901a\u8fc7\u66f4\u65b0\u539f\u578b\u7684age\u83b7\u5f97\u81ea\u5df1\u7684age\uff09\n\/\/Employee.prototype\u662f\u6253\u5370\u51fa\u6765\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u5176\u4ed6\u7684\uff0c\u901a\u8fc7__proto__\u90fd\u662f\u539f\u578b\u7684\n\/\/\u4e0a\u8282\u8001\u5e08\u8bf4\uff0c\u6784\u9020\u51fd\u6570Employee.prototype\u662f\u81ea\u5df1\u7684\u539f\u578b\uff0c\u5b57\u9762\u4e5f\u662f\u5982\u6b64\uff0c\u4f46\u662f\u6211\u611f\u89c9\u5b83\u7684\u539f\u578b\u4e0d\u5e94\u8be5\u662f__proto__\uff08\u518d\u5f80\u4e0a\u5e94\u8be5\u662f\u9876\u7aefObejct\u5bf9\u8c61\u5427\uff0c\u731c\uff01\uff09\uff0c\u4f46\u662f\u4e0a\u8282\u6709\u6d4b\u8bd5\uff1a\n\/\/console.log(Employee.__proto__);\/\/\u0192 () { [native code] }\uff0c\u6240\u4ee5\u5927\u6982\u662f\u4e2a\u7279\u6b8a\u7684\u89c4\u5b9a\u5427\u3002\u56e0\u4e3a\u6784\u9020\u51fd\u6570\u5f0f\u5bf9\u8c61\u7684\u5f00\u59cb\u3002\nconsole.log(manager);\n\/\/output\n\/\/ Employee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;, printInfo: \u0192}\n\/\/     name: &quot;\u674e\u56db&quot;                                   \/\/\u540e\u671f\u66f4\u65b0\u524d\u624b\u7684\u5c5e\u6027\u589e\u52a0\n\/\/     position: &quot;\u7ecf\u7406&quot;                               \/\/\u540e\u671f\u66f4\u65b0\u524d\u624b\u7684\u5c5e\u6027\u589e\u52a0\n\/\/     printInfo: \u0192 ()                               \/\/\u540e\u671f\u66f4\u65b0\u524d\u524d\u624b\u5c5e\u6027\u589e\u52a0\n\/\/     __proto__: Employee\n\/\/         age: 25                                   \/\/\u540e\u671f\u66f4\u65b0\u524d\u624b\u5c5e\u6027\u589e\u52a0\n\/\/         name: &quot;\u5f20\u4e09&quot;                               \/\/\u6784\u9020\u51fd\u6570\u672c\u4f53\u5185\u5b9a\u4e49\u540enew+\u53c2\u6570\u751f\u6210\u7684\u5c5e\u6027\n\/\/         position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;                      \/\/\u6784\u9020\u51fd\u6570\u672c\u4f53\u5185\u5b9a\u4e49\u540enew+\u53c2\u6570\u751f\u6210\u7684\u5c5e\u6027\n\/\/         signIn: \u0192 ()                              \/\/\u6784\u9020\u51fd\u6570\u672c\u4f53\u5185\u5b9a\u4e49\u540enew\u751f\u6210\u7684\u5c5e\u6027\n\/\/         __proto__:\n\/\/             age: 20                               \/\/\u540e\u671f\u8bed\u53e5\u589e\u52a0\uff0c\u8001\u5e08\u8bf4\u53ea\u6709\u6784\u9020\u51fd\u6570\u6709\u8fd9\u4e2aprototype\uff08\u56e0\u4e3a\u5b83\u662f\u6700\u521d\uff0c\u4e0d\u53ef\u80fd\u901a\u8fc7\u66f4\u65b0\u539f\u578b\u7684age\u83b7\u5f97\u81ea\u5df1\u7684age\uff09\uff0cEmployee.prototype.age = 20;\n\/\/             printInfo: \u0192 ()                       \/\/\u540e\u671f\u8bed\u53e5\u6dfb\u52a0\uff0c\u8001\u5e08\u8bf4\u53ea\u6709\u6784\u9020\u51fd\u6570\u6709\u8fd9\u4e2aprototype(Employee.prototype\u662f\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u5176\u4ed6\u7684__proto__\u90fd\u662f\u539f\u578b\u7684)\uff0cEmployee.prototype.printInfo = function(){};\n\/\/             constructor: \u0192 Employee(name,position)\/\/\u6700\u521d\u53ea\u6709\u4e00\u4e2a\u5c5e\u6027\uff1a\u6784\u9020\u51fd\u6570\u672c\u4f53\n\/\/             __proto__: Object\n\/\/end\nconsole.log(manager.__proto__.name);\/\/\u5f20\u4e09\nmanager.__proto__.__proto__.printInfo();\/\/undefined 20 undefined\n\/\/\u56e0\u4e3a\u6784\u9020\u51fd\u6570\u7684\u5c5e\u6027\u540e\u6765\u53ea\u589e\u52a0\u4e00\u4e2aage\uff1a20,\u548cprintInfo(),\n\/\/printInfo\u91cc\u9762\u6253\u5370this.name\u548cthis.positon,\u8fd9name\u548cposition\u81ea\u5df1\u6ca1\u6709\uff0c\u6240\u4ee5\u662fundefined\n\/\/\u4e0d\u77e5\u9053\u5e73\u65f6\u8c03\u7528Employ.printInfo()\u662f\u5426\u53ef\u4ee5,\u6d4b\u8bd5\u4e0d\u53ef\u4ee5\uff0c\u63d0\u793a\u4e0d\u662f\u4e00\u4e2a\u51fd\u6570\uff0c\u4f46\u662f\u901a\u8fc7__proto__\u5c42\u5c42\u8ffd\u6eaf\u5230\u65b9\u5f0f\u5374\u53ef\u4ee5\n\/\/Employee.printInfo();\/\/Uncaught TypeError: Employee.printInfo is not a function\n\n\/\/\u3010\u6bd4\u65b9\u3011\u6211\u6ca1\u7ed3\u5a5a\u7684\u65f6\u5019\uff0c\u6211\u548c\u7236\u6bcd\u4e00\u8d77\u751f\u6d3b\uff0c\u7238\u7238\u6709\u53f0\u7535\u8111\u3002emp1.signIn=function(){(console.log(CPU:I5)\uff1btoDo(&#039;\u5317\u4eac\u6b22\u8fce\u4f60&#039;);}\n\/\/\u6709\u4eba\u6765\u8bbf\u95ee\uff0c\u5f20\u6052\u501f\u4f60\u7684\u7535\u8111\u6211\u7528\u4e00\u4e0b\uff0c\u662f\u4e0d\u662f\u7528\u7684\u5176\u5b9e\u662f\u7236\u4eb2\u7684\u7535\u8111,manager.signIn()\uff0c\u6253\u5370\u51fa\u6765CPU\uff1aI5\uff0c\u542c\u6b4c\n\/\/\u540e\u6765\u6211\u4e70\u4e86\u65b0\u7535\u8111\uff0cmanager.signIn()=function(){console.log(CPU\uff1aI7);toDo(&#039;\u738b\u8005\u8363\u8000&#039;)\uff1b}\n\/\/\u6709\u5c0f\u670b\u53cb\u53c8\u6765\u501f\u7535\u8111\u73a9\uff0cmanager.signIn(),\u7ed3\u679c\u662f\u4ec0\u4e48\u5462\uff1f\u6253\u5370\u51faCPU\uff1aI7\uff0c\u73a9\u738b\u8005\n\/\/\u90a3\u4e48\u8fd9\u65f6\u5019\uff0c\u5c0f\u670b\u53cb\u8bf4\u6211\u60f3\u542c\u6b4c\uff0c\u6b4c\u53ea\u5b58\u5728\u7238\u7238\u7535\u8111\u4e0a\uff0c\u600e\u4e48\u529e\uff1f\n\/\/\u76f4\u63a5baba.signIn(),\u6216\u8005manager.__proto__.signIn()\u5373\u53ef\u3002\n\nconsole.log(emp1.__proto__ === Employee.prototype);\/\/true\nconsole.log(Employee.prototype);\n\/\/output:\u7b2c\u4e00\u884c\u76f4\u63a5{}\u3010\u7b2c\u4e00\u4ee3\uff1a\u6784\u9020\u51fd\u6570\u3011\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\nconsole.log(emp1.__proto__);\n\/\/output:\u7b2c\u4e00\u884c\u76f4\u63a5{}\u3010\u7b2c\u4e8c\u4ee3\uff1a\u5b9e\u4f8b\u3011\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\nconsole.log(manager.__proto__);\n\/\/output:\u7b2c\u4e00\u884cEmployee {}\u5f00\u5934\uff0c\u6784\u9020\u51fd\u6570\u5f00\u5934\u3010\u7b2c\u4e09\u4ee3\uff1a\u5b9e\u4f8b\u7ee7\u627f\u5b9e\u4f8b\u3011\n\/\/ Employee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, age: 25, signIn: \u0192}\n\/\/     age: 25\n\/\/     name: &quot;\u5f20\u4e09&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     signIn: \u0192 ()\n\/\/     __proto__:\n\/\/         age: 20\n\/\/         printInfo: \u0192 ()\n\/\/         constructor: \u0192 Employee(name,position)\n\/\/         __proto__: Object\n\/** *\/\n\n\/*P68-\u5bf9\u8c61-\u539f\u578b\u94fe\n\/\/\u539f\u578b\u94fe\u662f\u8bf4\uff0c\u6bcf\u4e2a\u5bf9\u8c61\u7684\u539f\u578b\u90fd\u8fd8\u4f1a\u6709\u4e00\u4e2a\u4e0a\u5c42\u7684\u539f\u578b\uff0c\u76f4\u5230\u9047\u5230null\uff0c\u8fd9\u79cd\u94fe\u5f0f\u7ee7\u627f\u4e0b\u6765\u7684\u539f\u578b\u5c31\u662f\u539f\u578b\u94fe\n\/\/JS\u4e2d\u6700\u9876\u5c42\u7684\u5bf9\u8c61\u662fObject,\u5b83\u7684\u539f\u578b\u662fObject.prototype,\u5b83\u7684\u539f\u578b\u7684\u539f\u578b\u5c31\u662fnull\uff0c\u8fbe\u5230\u539f\u578b\u94fe\u7684\u9876\u7aef\n\/\/VH\uff1a\u6211\u8ba4\u4e3a\u51fd\u6570.prototype\uff08\u51fd\u6570\u7279\u6709\u7684.prototype,\u4e0a\u53e5\u8001\u5e08\u8bf4\u9876\u7ea7\u5bf9\u8c61Object\u4e5f\u6709.prototype\uff09\u5176\u5b9e\u662f\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u7279\u6b8a\u89c4\u5b9a\u53eb\u81ea\u5df1\u7684\u539f\u578b\u3002\n\/\/VH\uff1a\u56e0\u4e3a\u5bf9\u4e8e\u666e\u901a\u5bf9\u8c61\u6765\u8bf4\uff0c.__proto__\u770b\u5230\u7684\u7edd\u5bf9\u4e0d\u662f\u81ea\u5df1\u7684\u5c5e\u6027\u3002\u800c\u51fd\u6570\u548c\u9876\u7ea7\u5bf9\u8c61Obejct\u4f7f\u7528.prototype\u770b\u5230\u7684\u662f\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u5176\u4e2d\u5305\u62ec__proto__,\u8fd9\u4e2a\u624d\u662f\u771f\u7684\u539f\u578b\u3002\n\/\/VH\uff1a\u4e0d\u8fc7\u6211\u4eec\u6682\u4e14\u53ef\u4ee5\u8fd9\u4e48\u8bf4\u51fd\u6570\u548c\u9876\u7ea7\u5bf9\u8c61Obejct\u4f7f\u7528.prototype\u770b\u5230\u7684\u662f\u81ea\u5df1\u7684\u539f\u578b\uff0c\u8fd9\u662f\u7279\u6b8a\u89c4\u5b9a\n\n\/\/\u590d\u5236\u4e0a\u8282\u4ee3\u7801\u4e3a\u672c\u8282\u505a\u94fa\u57ab\uff0c\u56e0\u4e3a\u540e\u671f\u81ea\u5df1\u5199\u4e86\u4e00\u4e9b\u4ee3\u7801\u6d4b\u8bd5\uff0c\u6240\u4ee5\uff0c\u8fd9\u91cc\u590d\u5236\u5e72\u51c0\u4ee3\u7801\uff0c\u4fdd\u6301\u6548\u679c\u548c\u8001\u5e08\u4e00\u81f4\n\/\/\u6ce8\u610f\u4e0a\u8282\u7684\u4ee3\u7801\u9700\u8981\u6ce8\u91ca\u6389\uff0c\u4e00\u822c\u4f1a\u6ce8\u91ca\uff0c\u4e0d\u8fc7\u521a\u5fd8\u8bb0\uff0c\u8fd9\u5c31\u6709\u63d0\u793a\u4e0b\u884c\u6709\u9519\u8bef\uff1a\/\/Uncaught SyntaxError: Identifier &#039;Employee&#039; has already been declared\nfunction Employee(name,position){\n    this.name = name;\n    this.position = position;\n    this.signIn = function(){\n        console.log(this.name+&#039;\u6253\u5361&#039;);\n    };\n};\nvar emp1 = new Employee(&#039;\u5f20\u4e09&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nvar emp2 = new Employee(&#039;\u674e\u56db&#039;,&#039;\u540e\u7aef\u5de5\u7a0b\u5e08&#039;);\nEmployee.prototype.age = 20;\nEmployee.prototype.printInfo = function(){\n    console.log(this.name, this.age, this.position);\n};\nvar manager = Object.create(emp1);\nconsole.log(manager);\nfor(let key in manager){\n    console.log(key);\n}\nconsole.log(manager.name);\/\/\u5f20\u4e09\nmanager.name=&#039;\u674e\u56db&#039;;\nmanager.position=&#039;\u7ecf\u7406&#039;;\nmanager.signIn();\nconsole.log(Object.getOwnPropertyNames(manager));\n\n\/\/manager\u7684\u539f\u578b\nconsole.clear();\n\/\/VH\uff1a\u9996\u5148\u6253\u5370\u81ea\u5df1manager,\u5c31\u80fd\u6e05\u695a\u770b\u5230\u8fd9\u4e2a\u94fe\nconsole.log(manager);\n\/\/VH\uff1amanager\u7684\u539f\u578b\uff0c\u662femp1\u7684\u5c5e\u6027\nvar protoOfManager = Object.getPrototypeOf(manager);\nconsole.log(protoOfManager);\n\/\/VH\uff1aemp1\u7684\u539f\u578b\uff0c\u662f\u6784\u9020\u51fd\u6570\u7684\u5c5e\u6027\nvar protoOfEmp1 = Object.getPrototypeOf(protoOfManager);\nconsole.log(protoOfEmp1);\n\/\/VH\uff1a\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\uff0c\u662fObject\u7684\u5c5e\u6027\u3010\u4e0d\u662f.prototype\u5f97\u5230\u7684\u5185\u5bb9\u3011\nvar protoOfEmp = Object.getPrototypeOf(protoOfEmp1);\nconsole.log(protoOfEmp);\n\/\/VH\uff1aObject\u7684\u539f\u578b\uff0c\u662fnull\nvar protoOfObj = Object.getPrototypeOf(protoOfEmp);\nconsole.log(protoOfObj);\n\/\/\u76f4\u63a5\u67e5\u770b\nconsole.log(Object.getPrototypeOf(Object.prototype));\n\/\/output:\n\/\/ Employee {name: &quot;\u674e\u56db&quot;, position: &quot;\u7ecf\u7406&quot;}\n\/\/     name: &quot;\u674e\u56db&quot;\n\/\/     position: &quot;\u7ecf\u7406&quot;\n\/\/     __proto__: Employee\n\/\/\n\/\/ Employee {name: &quot;\u5f20\u4e09&quot;, position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;, signIn: \u0192}\n\/\/     name: &quot;\u5f20\u4e09&quot;\n\/\/     position: &quot;\u524d\u7aef\u5de5\u7a0b\u5e08&quot;\n\/\/     signIn: \u0192 ()\n\/\/     __proto__: Object\n\/\/\n\/\/ {age: 20, printInfo: \u0192, constructor: \u0192}\n\/\/     age: 20\n\/\/     printInfo: \u0192 ()\n\/\/     constructor: \u0192 Employee(name,position)\n\/\/     __proto__: Object\n\/\/\n\/\/ {constructor: \u0192, __defineGetter__: \u0192, __defineSetter__: \u0192, hasOwnProperty: \u0192, __lookupGetter__: \u0192, \u2026}\n\/\/     constructor: \u0192 Object()\n\/\/     hasOwnProperty: \u0192 hasOwnProperty()\n\/\/     isPrototypeOf: \u0192 isPrototypeOf()\n\/\/     propertyIsEnumerable: \u0192 propertyIsEnumerable()\n\/\/     toLocaleString: \u0192 toLocaleString()\n\/\/     toString: \u0192 toString()\n\/\/     valueOf: \u0192 valueOf()\n\/\/     __defineGetter__: \u0192 __defineGetter__()\n\/\/     __defineSetter__: \u0192 __defineSetter__()\n\/\/     __lookupGetter__: \u0192 __lookupGetter__()\n\/\/     __lookupSetter__: \u0192 __lookupSetter__()\n\/\/     get __proto__: \u0192 __proto__()\n\/\/     set __proto__: \u0192 __proto__()\n\/\/\n\/\/ null\n\/\/\n\/\/ null\n\/\/Object.prototype\u4e2d\u6709\u4e00\u4e2atoString()\u65b9\u6cd5\uff0c\u53ef\u4ee5\u4f20\u9012\u5230\u539f\u578b\u94fe\u7684\u6700\u5e95\u7aef\uff0c\u7528manager\u53bb\u4f7f\u7528\u5b83\u3002\n\/\/toString()\u65b9\u6cd5\u662f\u67e5\u770b\u5bf9\u8c61\u7684\u7c7b\u578b\nconsole.log(manager.toString);\/\/\u0192 toString() { [native code] }\nconsole.log(manager.toString());\/\/[object Object]\nconsole.log(Object.toString());\/\/function Object() { [native code] }\nconsole.log(Employee.toString());\nconsole.log(Employee);\n\/\/output\n\/\/ function Employee(name,position){\n\/\/     this.name = name;\n\/\/     this.position = position;\n\/\/     this.signIn = function(){\n\/\/         console.log(this.name+&#039;\u6253\u5361&#039;);\n\/\/     };\n\/\/ }\n\n\/\/ \u0192 Employee(name,position){\n\/\/     this.name = name;\n\/\/     this.position = position;\n\/\/     this.signIn = function(){\n\/\/         console.log(this.name+&#039;\u6253\u5361&#039;);\n\/\/     };\n\/\/ }\n\/\/end\n\n\/\/\u5927\u6d4b\u8bd5\nconsole.log(emp1);\/\/\u5bf9\u8c61\nconsole.log(protoOfManager===emp1);\/\/true\n\/\/\u6d4b\u8bd5\u5f00\u59cb\uff1a\nconsole.log(Employee);\/\/\u51fd\u6570\u4f53\/\/\u5e76\u4e0d\u662f\u7684\u5bf9\u8c61\uff0c\u52a0()\u5c31\u662f\u8fd0\u884c\uff0c\u53ea\u80fd\u4f7f\u7528Employee.prototype\u8fbe\u5230\u6548\u679c\nconsole.log(Employee.prototype);\/\/\u51fd\u6570\u7684.prototype\uff08\u5c5e\u6027\uff09\uff0c\u5bf9\u8c61\u7ed3\u6784\nconsole.log(protoOfEmp1===Employee.prototype);\/\/true\nconsole.log(Object.getPrototypeOf(Employee));\/\/\u0192 () { [native code] }\/\/\u6211\u4eec\u80fd\u7528\n\/\/\u6d4b\u8bd5\u5f00\u59cb\uff1a\nconsole.log(Object);\/\/\u0192 Object() { [native code] }\nconsole.log(Object.prototype);\/\/\u5bf9\u8c61\u7c7b\u578b\/\/{constructor: \u0192, __defineGetter__: \u0192, __defineSetter__: \u0192, hasOwnProperty: \u0192, __lookupGetter__: \u0192,\u00a0\u2026}\nconsole.log(protoOfEmp===Object.prototype);\/\/true\n\/\/\u8fd8\u6709\u4e2a\u67e5\u770b\u81ea\u5df1\u5c5e\u6027\u7684\u65b9\u6cd5\u53ef\u4ee5\u6d4b\u8bd5\nconsole.log(Object.getOwnPropertyNames(manager));\/\/(2)\u00a0[&quot;name&quot;, &quot;position&quot;]\nconsole.log(Object.getOwnPropertyNames(emp1));\/\/(3)\u00a0[&quot;name&quot;, &quot;position&quot;, &quot;signIn&quot;]\nconsole.log(Object.getOwnPropertyNames(Employee));\/\/(3)\u00a0[&quot;length&quot;, &quot;name&quot;, &quot;prototype&quot;]\nconsole.log(Object.getOwnPropertyNames(Object));\/\/(24)\u00a0[&quot;length&quot;, &quot;name&quot;, &quot;prototype&quot;, &quot;assign&quot;, &quot;getOwnPropertyDescriptor&quot;, &quot;getOwnPropertyDescriptors&quot;, &quot;getOwnPropertyNames&quot;, &quot;getOwnPropertySymbols&quot;, &quot;is&quot;, &quot;preventExtensions&quot;, &quot;seal&quot;, &quot;create&quot;, &quot;defineProperties&quot;, &quot;defineProperty&quot;, &quot;freeze&quot;, &quot;getPrototypeOf&quot;, &quot;setPrototypeOf&quot;, &quot;isExtensible&quot;, &quot;isFrozen&quot;, &quot;isSealed&quot;, &quot;keys&quot;, &quot;entries&quot;, &quot;fromEntries&quot;, &quot;values&quot;]\n\n\/\/ \u539f\u578b__proto__\u548c\u539f\u578b\u5bf9\u8c61prototype\uff0c\n\/\/ \u7f51\u53cb\u4e5f\u53eb\u9690\u5f0f\u539f\u578b\uff0c\u548c\u663e\u5f0f\u539f\u578b\u3002\n\/\/ \u4e00\u822c\u6765\u8bf4\uff0c\u5bf9\u8c61\u90fd\u6709\u9690\u5f0f\u539f\u578b\uff0c\u5f62\u6210\u539f\u578b\u94fe\u3002\n\/\/ \u51fd\u6570\u624d\u6709prototype\uff0c\u663e\u5f0f\u539f\u578b\uff08\u51fd\u6570\u4e5f\u662f\u5bf9\u8c61\uff0c\u6700\u540e\u518d\u8bf4\uff09\n\/\/ \u539f\u578b\u662f\u6307\u5b9e\u4f8b\u7684__proto__\u6307\u5411\u7684\u7236\u7ea7\u7684\u5bf9\u8c61\uff08\u4e5f\u53ef\u80fd\u662f\u5b9e\u4f8b\uff09\n\/\/ \u539f\u578b\u5bf9\u8c61\u6307\u7684\u662f\u51fd\u6570\u7684\u6837\u54c1\u5b9e\u4f8b\u9ed8\u8ba4\u7684\u6837\u54c1\u3002\u4e5f\u662f\u4e2a\u5bf9\u8c61\u3002\n\n\/\/ \u6784\u9020\u51fd\u6570\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u81ea\u5df1\u4e5f\u662f\u5bf9\u8c61\uff0c\u4f46\u662f\u81ea\u5df1\u5728\u539f\u578b\u94fe\u7684\u65f6\u5019\uff0c\u662f\u81ea\u5df1\u7684\u539f\u578b\u5bf9\u8c61\u6765\u53c2\u4e0e\u7684\u3002\u6240\u4ee5\uff0c\n\/\/ \u6211\u4eec\u5728\u4f7f\u7528Object.getPrototypeOf()\u7684\u65f6\u5019\uff0c\u5f97\u5230\u7684\u662f\u6784\u9020\u51fd\u6570.prototype\uff08\u8fd9\u4e2a\u5c5e\u6027\u503c\u662f\u5bf9\u8c61\u7c7b\u578b\u7684\uff09\n\n\/\/ \u800cmanager\u7ee7\u627f\u81eaemp1,\u4e24\u4e2a\u90fd\u662f\u5bf9\u8c61\uff0c\u6240\u4ee5\uff0c\n\/\/ manager\u7684\u539f\u578b\u662femp1,\n\/\/ \u4f46emp1\u7684\u539f\u578b\u662f\u6784\u9020\u51fd\u6570.prototype\u7684\u503c\uff08\u5047\u5982\u662fA\uff0c\u5bf9\u8c61\u7c7b\u578b\uff09\n\n\/\/ \u90a3\u8fd9\u4e2aA\u7684\u539f\u578b\u662fObject.prototype\u7684\u503c\uff08\u52a0\u5165\u662fb,b\u4e5f\u662f\u5bf9\u8c61\u7c7b\u578b\uff09\n\n\/\/ \u5982\u679c\u4f5c\u4e3a\u5bf9\u8c61\uff0c\n\/\/ \u6784\u9020\u51fd\u6570\u7684\u5bf9\u8c61\u5c5e\u6027\u6709\u54ea\u4e9b\u5462\uff1f\u6211\u4eec\u80fd\u770b\u5230(3)\u00a0[&quot;length&quot;, &quot;name&quot;, &quot;prototype&quot;]\uff0c\u5176\u4e2d\u662f\u6709prototype\u5c5e\u6027\u7684\u3002\n\/\/ \u6240\u4ee5\uff0c\u5728\u539f\u578b\u94fe\u4e2d\uff0c\u5230\u6784\u9020\u51fd\u6570\u8fd9\u91cc\uff0c\u5c31\u662f\u4f7f\u7528\u5b83.prototype\n\/\/ \u539f\u578b\u90fd\u662f\u5bf9\u8c61\uff0c\u6784\u9020\u51fd\u6570\u8fd9\u91cc\u662f\u51fd\u6570\uff0c\u4e0d\u662f\u5bf9\u8c61\u3002\u5b83\u662f\u4f7f\u7528\u81ea\u5df1\u7684\u4e00\u4e2a\u6837\u54c1\u5bf9\u8c61\u6765\u7ed9\u4eba\u5bb6\u7ee7\u627f\u7684\u3002\u4e0d\u662f\u81ea\u5df1\u3002\nconsole.log(Object.getOwnPropertyNames(Employee));\/\/(3)\u00a0[&quot;length&quot;, &quot;name&quot;, &quot;prototype&quot;]\n\/\/ \u6784\u9020\u51fd\u6570\u4f5c\u4e3a\u5bf9\u8c61\u539f\u578b\u662f\u5565\u5c31\u662f\u7528__proto__\u6765\u67e5\u770b\u3002\n\/\/ \u6216\u8005\u662f\u4f7f\u7528\nconsole.log(Employee.__proto__);\/\/\u0192 () { [native code] }\nconsole.log(Object.getPrototypeOf(Employee));\/\/\u0192 () { [native code] }\n\n\/\/\u8fd9\u91cc\u6709\u4e2a\u6bd4\u55bb\uff0c\n\/\/\u51fd\u6570\u662f\u9a6c\u826f\uff0c\u5b83\u7167\u7740\u5973\u513f\u753b\u4e86\u4e00\u5e45\u753b\uff0c\u53d8\u6210\u4e86\u4e00\u4e2a\u5973\u5b69\u3002\u5973\u5b69\u751f\u4e86\u4e2a\u5973\u5b69\u3002\n\/\/\u5deb\u5a46\uff0c\u7ee7\u627f\u7684\u4e0d\u662f\u9a6c\u826f\uff0c\u800c\u662f\u9a6c\u826f\u7684\u5973\u513f\uff0c\n\/\/\u9a6c\u826f\u7684\u5973\u513f\u7ee7\u627f\u81eaObject.\u5973\u513f\u3002\n\/\/\u5973\u5a32\u634f\u4e86\u4e00\u4e2a\u5973\u5b69\u7ed9\u9a6c\u826f\u5f53\u5ab3\u5987\uff0c\u9a6c\u826f\u7167\u7740\u5ab3\u5987\u753b\u4e86\u4e00\u4e2a\u5973\u4eba\uff0c\u5973\u4eba\u751f\u5973\u513f\uff0c\u5973\u513f\u751f\u5973\u513f\u3002\n\/\/\/\uff0c\u753b\u4e86\u753b\u53d8\u6210\u4ed9\u5973\u5973\u513f\uff0c\u7ed9\u4e86\u9a6c\u826f\u5f53\u5973\u513f\uff0c\u9a6c\u826f\u7167\u7740\u5973\u513f\u753b\u4e86\u753b\uff0c\u53d8\u6210\u4e86\u4eba\u5973\u5b691\uff0c\u5973\u5b69\u53c8\u751f\u4eba\u5973\u513f2\uff0c\u5973\u513f\u53c8\u751f\u4eba\u5973\u513f3\u3002\n\/\/\u6211\u8bf4\u753b\u51fa\u6765\uff0c\u610f\u601d\u662f\u4eff\u7167\u7684\u6765\uff0c\u4e0d\u662f\u751f\u51fa\u6765\u3002\n\/\/\u6211\u4eff\u7167\u7684\u5bf9\u8c61\u662f\u4f60\u751f\u51fa\u7684\u5417\uff1f\u4e0d\u662f\u662f\u6211\u4eff\u7167\u51fa\u6765\u7684\u3002\u4eff\u7167\u8c01\u5462\uff1f\n\n\/\/\u8bb8\u613f\u6c60null0\uff0c\u795e\u4ed9\u60f3\u8981\u8001\u4f34\uff0c\u4ece\u8bb8\u613f\u6c60\u8d70\u51fa\u6765\u4e00\u4f4d\u8001\u4f34\uff0cobjcet.\u8001\u4f341\u6765\u81ea\u8bb8\u613f\u6c60\n\/\/\u8001\u795e\u4ed9\u770b\u9a6c\u826f\u4e0d\u9519\uff0c\u7167\u7740\u81ea\u5df1\u7684\u8001\u4f34\u753b\u4e86\u4e00\u526f\u753b\u53d8\u6210\u4e86\u4eba\u7ed9\u9a6c\u826f\u505a\u5ab3\u59872\uff0c\u9a6c\u826f.\u8001\u4f34\u6765\u81ea\u8001\u795e\u4ed9.\u8001\u4f34\n\/\/\u9a6c\u826f\u7167\u7740\u81ea\u5df1\u7684\u5ab3\u5987\u753b\u4e86\u4e00\u5e45\u753b\uff0c\u6210\u4e86\u6f02\u4eae\u5973\u5b50\u897f\u65bd3\uff0c\u897f\u65bd\u6765\u81ea\u4e8e\u9a6c\u826f.\u8001\u4f34\n\/\/\u897f\u65bd3\u751f\u4e86\u5973\u513f\uff0c\u4e1c\u65bd4,\n\n\/\/\u90a3\u4e48\u795e\u4ed9\uff0c\u9a6c\u826f\u4f5c\u4e3a\u5b9e\u4f8b\uff0c\u600e\u4e48\u6765\u7684\u5462\uff1f\u8fd9\u4e9b\u600e\u4e48\u6765\u7684\u5462\uff1f\n\/\/console.log()\u7684\u4f5c\u7528\u662f\u6253\u5370\u672c\u4f53\u5bf9\u8c61\u51fa\u672c\u4f53\uff0c\u80fd\u76f4\u63a5\u67e5\u770b__proto__,\u51fd\u6570\u4e0d\u5e26()\u7684\u8bdd\u51fa\u5b9a\u4e49\uff0c\u5e26()\u5c31\u662f\u8fd0\u884c\uff0c\u6253\u5370\u8fd4\u56de\u503c\u800c\u5df2\uff0c\u4e0d\u4f1a\u663e\u793a\u4f5c\u4e3a\u5bf9\u8c61\u7684\u7ed3\u679c\u3002\nconsole.log(Object);\/\/\u0192 Object() { [native code] }\nconsole.log(Employee);\/\/\u51fd\u6570\u4f53\/\/\u5e76\u4e0d\u662f\u7684\u5bf9\u8c61\uff0c\u52a0()\u5c31\u662f\u8fd0\u884c\uff0c\u53ea\u80fd\u4f7f\u7528Employee.prototype\u8fbe\u5230\u6548\u679c\n\/\/\u81ea\u5df1\u4f5c\u4e3a\u5b9e\u4f8b\u7684\u539f\u578b\u662f\u4ec0\u4e48\uff1f\nconsole.log(Object.getPrototypeOf(Employee));\/\/\u0192 () { [native code] }\nconsole.log(Object.getPrototypeOf(Object));\/\/\u0192 () { [native code] }\nconsole.log(Employee.__proto__);\/\/\u0192 () { [native code] }\nconsole.log(Object.__proto__);\/\/\u0192 () { [native code] }\n\n\/\/\u7f51\u53cb\uff1a__proto__\uff0c\u6307\u5411\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\u5bf9\u8c61\n\/\/ \u6784\u9020\u51fd\u6570Foo()\u9664\u4e86\u662f\u65b9\u6cd5\uff0c\u4e5f\u662f\u5bf9\u8c61\u554a\uff0c\u5b83\u4e5f\u6709__proto__\u5c5e\u6027\uff0c\u6307\u5411\u8c01\u5462\uff1f\n\n\/\/ \u6307\u5411\u5b83\u7684\u6784\u9020\u51fd\u6570\u7684\u539f\u578b\u5bf9\u8c61\u5457\u3002\u51fd\u6570\u7684\u6784\u9020\u51fd\u6570\u4e0d\u5c31\u662fFunction\u561b\uff0c\u56e0\u6b64\u8fd9\u91cc\u7684__proto__\u6307\u5411\u4e86Function.prototype\u3002\nconsole.log(Function.prototype);\/\/\u0192 () { [native code] }\nconsole.log(Object.constructor);\/\/\u0192 Function() { [native code] }\n\/\/\u90a3\u4e48\u8fd9\u662f\u5565\u610f\u601d\u5462\uff1f\u5c31\u662f\uff1f\n\n\/\/ \u5c31\u662f\u8bf4\uff0c\u5982\u679c\u628a\u51fd\u6570\u5f53\u505a\u5bf9\u8c61\uff0c\u90a3\u4e48\u5b83\u7684\u4e5f\u6709\u6784\u9020\u51fd\u6570\uff0cFunction\uff0c\uff0cfuntion\u6839\u636e\u81ea\u5df1\u7684\u5ab3\u5987\u753b\u4e86\u4e00\u4e2a\u5973\u5b50\uff0c\u90a3\u4e48\u8fd9\u4e2a\u4eba\u662f\u9a6c\u826f(Employee)\u5427\u3002\n\/\/ \u795e\u4ed9\u753b\u5e08\u7b97\u4ec0\u4e48\uff1f\u5b83\u662f\u51fd\u6570\u4e48\uff1f\n\/\/ function\u7684\u5ab3\u5987\u4ece\u54ea\u91cc\u6765\u7684\uff1fobject.prototype\u3002\u8001\u753b\u5e08\u7684\u5ab3\u5987\u6765\u7684\u4e48\uff1f\n\/\/ function\u4ece\u54ea\u91cc\u6765\u7684\u5462\uff1f\u5b83\u662ffunction\uff0c\u8fd9\u662f\u51fd\u6570\u8fd8\u662f\u5bf9\u8c61\u5462\uff1f\u3001\n\/\/ \u7ed9\u8fd9\u4e9b\u4f5c\u4e3a\u5bf9\u8c61\u4eba\u6dfb\u52a0\u5c5e\u6027\u548c\u65b9\u6cd5\u53ef\u4ee5\u4e48\uff1f\n\n\/\/ \u5176\u4ed6\u4e00\u4e9b\u601d\u8003\uff1a\n\/\/ \u539f\u578b__proto__\u548c\u539f\u578b\u5bf9\u8c61prototype\uff0c\n\/\/ \u7f51\u53cb\u4e5f\u53eb\u9690\u5f0f\u539f\u578b\uff0c\u548c\u663e\u5f0f\u539f\u578b\u3002\n\/\/ \u4e00\u822c\u6765\u8bf4\uff0c\u5bf9\u8c61\u90fd\u6709\u9690\u5f0f\u539f\u578b\uff0c\u5f62\u6210\u539f\u578b\u94fe\u3002\n\/\/ \u51fd\u6570\u624d\u6709prototype\uff0c\u663e\u5f0f\u539f\u578b\uff08\u51fd\u6570\u4e5f\u662f\u5bf9\u8c61\uff0c\u6700\u540e\u518d\u8bf4\uff09\n\/\/ \u539f\u578b\u662f\u6307\u5b9e\u4f8b\u7684__proto__\u6307\u5411\u7684\u7236\u7ea7\u7684\u5bf9\u8c61\uff08\u4e5f\u53ef\u80fd\u662f\u5b9e\u4f8b\uff09\n\/\/ \u539f\u578b\u5bf9\u8c61\u6307\u7684\u662f\u51fd\u6570\u7684\u6837\u54c1\u5b9e\u4f8b\u9ed8\u8ba4\u7684\u6837\u54c1\u3002\u4e5f\u662f\u4e2a\u5bf9\u8c61\u3002\n\n\/\/ \u6784\u9020\u51fd\u6570\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u81ea\u5df1\u4e5f\u662f\u5bf9\u8c61\uff0c\u4f46\u662f\u81ea\u5df1\u5728\u539f\u578b\u94fe\u7684\u65f6\u5019\uff0c\u662f\u81ea\u5df1\u7684\u539f\u578b\u5bf9\u8c61\u6765\u53c2\u4e0e\u7684\u3002\u6240\u4ee5\uff0c\n\/\/ \u6211\u4eec\u5728\u4f7f\u7528Object.getPrototypeOf()\u7684\u65f6\u5019\uff0c\u5f97\u5230\u7684\u662f\u6784\u9020\u51fd\u6570.prototype\uff08\u8fd9\u4e2a\u5c5e\u6027\u503c\u662f\u5bf9\u8c61\u7c7b\u578b\u7684\uff09\n\n\/\/ \u800cmanager\u7ee7\u627f\u81eaemp1,\u4e24\u4e2a\u90fd\u662f\u5bf9\u8c61\uff0c\u6240\u4ee5\uff0c\n\/\/ manager\u7684\u539f\u578b\u662femp1,\n\/\/ \u4f46emp1\u7684\u539f\u578b\u662f\u6784\u9020\u51fd\u6570.prototype\u7684\u503c\uff08\u5047\u5982\u662fA\uff0c\u5bf9\u8c61\u7c7b\u578b\uff09\n\n\/\/ \u90a3\u8fd9\u4e2aA\u7684\u539f\u578b\u662fObject.prototype\u7684\u503c\uff08\u52a0\u5165\u662fb,b\u4e5f\u662f\u5bf9\u8c61\u7c7b\u578b\uff09\n\n\/\/ \u5982\u679c\u4f5c\u4e3a\u5bf9\u8c61\uff0c\n\/\/ \u6784\u9020\u51fd\u6570\u7684\u5bf9\u8c61\u5c5e\u6027\u6709\u54ea\u4e9b\u5462\uff1f\n\/\/ \u6784\u9020\u51fd\u6570\u4f5c\u4e3a\u5bf9\u8c61\u539f\u578b\u662f\u5565\u5c31\u662f\u7528__proto__\u6765\u67e5\u770b\u3002\n\n\/** *\/\n\n\/*P69-\u5bf9\u8c61-\u4fee\u6539\u539f\u578b\u6307\u5411\n\/\/\u901a\u8fc7\u4fee\u6539\u539f\u578b\u6307\u5411\uff0c\u6539\u53d8\u5b83\u7684\u7ee7\u627f\u5173\u7cfb\n\/\/\u590d\u5236\u4e0a\u8282\u5fc5\u8981\u4ee3\u7801\nfunction Employee(name,position){\n    this.name = name;\n    this.position = position;\n    this.signIn = function(){\n        console.log(this.name+&#039;\u6253\u5361&#039;);\n    };\n};\nvar emp1 = new Employee(&#039;\u5f20\u4e09&#039;,&#039;\u524d\u7aef\u5de5\u7a0b\u5e08&#039;);\nEmployee.prototype.age = 20;\nEmployee.prototype.printInfo = function(){\n    console.log(this.name, this.age, this.position);\n};\nvar manager = Object.create(emp1);\nmanager.name=&#039;\u674e\u56db&#039;;\nmanager.position=&#039;\u7ecf\u7406&#039;;\n\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u540d\u53ebManager\u7684\u6784\u9020\u51fd\u6570\nfunction Manager(){\n\n}\n\/\/\u7ed9Manager\u7684prototype\u6dfb\u52a0\u65b0\u7684\u5c5e\u6027\nManager.prototype.department = &#039;\u6280\u672f\u90e8&#039;;\n\/\/\u6539\u53d8manager\u7684prototype\u7ed9\u6539\u53d8\u4e00\u4e0b\uff0c\nObject.setPrototypeOf(manager,Manager.prototype);\n\/\/\u8fd9\u6837manager\u5c31\u6709\u4e86\u6784\u9020\u51fd\u6570Manager.prototype.department\u7684\u5c5e\u6027\nconsole.log(manager.department);\/\/\u6280\u672f\u90e8\n\/\/\u67e5\u770b\u539f\u578b\uff0c\u53ea\u6709department\u4e00\u4e2a\u5c5e\u6027\uff0c\u7136\u540e\u5b83\u5c31\u53d8\u6210\u4e86Manager\u8fd9\u4e2a\u6784\u9020\u51fd\u6570\u4e86\nconsole.log(Object.getPrototypeOf(manager));\/\/{department: &quot;\u6280\u672f\u90e8&quot;, constructor: \u0192}\n\/\/\u518d\u8bbf\u95eeemp1\u91cc\u9762\u7684\u65b9\u6cd5\uff0c\u5c31\u8bbf\u95ee\u4e0d\u5230\u4e86\u3002\n\/\/console.log(manager.signIn());\/\/manager.signIn is not a function\n\/\/\u5faa\u73af\u904d\u5386\u4e00\u4e0b\u5b83\u7684\u5c5e\u6027\uff0c\u770b\u5230\u53ea\u6709name\uff0cposition\uff0cdepartment\n\nfor(let key in manager){\n    console.log(key);\n}\n\/\/output\n\/\/ name \/\/\u662fmanager\u4e4b\u524d\u5b9a\u4e49\u7684\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u4e0d\u662f\u7ee7\u627f\u7684\n\/\/ position \/\/\u662fmanager\u4e4b\u524d\u5b9a\u4e49\u7684\u81ea\u5df1\u7684\u5c5e\u6027\uff0c\u4e0d\u662f\u7ee7\u627f\u7684\n\/\/ department \/\/\u662f\u5b83\u7684\u6784\u9020\u51fd\u6570.prototype\u91cc\u9762\u5b9a\u4e49\u7684\uff0c\n\/\/\u662f\u8fd9\u4e2a\u4e5f\u4e0d\u662f\u81ea\u5df1\u7684\u5427\uff0c\uff08\u4e3a\u5565\u4f1a\u51fa\u73b0\u5462\uff1f\uff09\u8fd9\u4e2a\u662fManger.prototype\u7684\n\/\/end\n\n\/\/\u6240\u4ee5\uff0c\u6539\u4e86\u539f\u578b\u4e4b\u540e\uff0c\u548cEmployee\u5c31\u6ca1\u6709\u4efb\u4f55\u5173\u7cfb\u4e86\u3002\n\/\/\u901a\u8fc7\u8fd9\u4e2a\u65b9\u5f0f\uff0c\u53ef\u4ee5\u628a\u5bf9\u8c61\u7684\u7ee7\u627f\u5173\u7cfb\u7ed9\u6539\u53d8\uff0c\u8ba9\u5b83\u7ee7\u627f\u81ea\u5176\u4ed6\u4e1c\u897f\n\n\/\/\u53e6\u5916\u5229\u7528\u539f\u578bprototype\uff0c\u4e00\u5927\u7528\u9014\uff0c\u7ed9\u73b0\u6709\u7684Object\u6dfb\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u5c5e\u6027\n\/\/\u7136\u540e\u8ba9\u5b83\u6240\u6709\u7684\u5bf9\u8c61\u90fd\u80fd\u591f\u4f7f\u7528\uff0c\u6bd4\u5982\uff0cJS\u5185\u7f6e\u5bf9\u8c61Array,\u5b83\u6709\u4e00\u4e9bforEach\uff0cmap\u4e4b\u7c7b\u7684\u65b9\u6cd5\n\/\/\u54b1\u4eec\u901a\u8fc7\u53ef\u4ee5\u6539\u53d8Array.prototype\u7ed9\u5b83\u6dfb\u52a0\u4e00\u4e9b\u65b0\u7684\u5c5e\u6027\u6216\u8005\u65b9\u6cd5\u8fdb\u53bb\uff0c\n\/\/\u90a3\u4e48\u53ea\u8981\u662f\u6570\u7ec4\uff0c\u5b83\u90fd\u53ef\u4ee5\u65b9\u4fbf\u8bbf\u95ee\u5230\u54b1\u4eec\u65b0\u6dfb\u52a0\u7684\u5c5e\u6027\u6216\u65b9\u6cd5\n\/\/\u8fd9\u5c31\u53ef\u4ee5\u7528\u6765\u505a\u4e00\u4e9b\u6269\u5c55\uff0c\u5c31\u76f8\u5f53\u4e8e\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u7684extention\u8fd9\u6837\u7684\u8bed\u6cd5\n\/\/\u5927\u5bb6\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u5b9e\u9645\u60c5\u51b5\u53bb\u4f7f\u7528\u5b83\n\n\/\/\u53e6\u4e00\u79cd\u5c31\u662f\u7ee7\u627f\u5173\u7cfb\uff0c\u4e00\u4e9b\u5bf9\u8c61\u8981\u7ee7\u627f\u53e6\u4e00\u4e9b\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u54b1\u4eec\u53ef\u4ee5\u4e0d\u7528\u91cd\u590d\u5b9a\u4e49\n\/\/\u76f4\u63a5\u7528\u5b83prototype\u91cc\u7ee7\u627f\u4e0b\u6765\u7684\u65b9\u6cd5\u5c31\u53ef\u4ee5\u4e86\u3002\n\/\/\u6bd4\u5982object\u91cc\u9762\u7684toString\uff0c\u54b1\u4eec\u5728\u5e95\u4e0b\u6240\u6709\u7684\u5bf9\u8c61\u4e2d\u90fd\u53ef\u4ee5\u4f7f\u7528\n\/\/\u54b1\u4eec\u4e5f\u53ef\u4ee5\u81ea\u5df1\u5b9a\u4e49\u8fd9\u4e9b\u5c5e\u6027\uff0c\u8ba9\u7ee7\u627f\u8005\u90fd\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e9b\u5c5e\u6027\n\/** *\/\n\n\/*70-\u5bf9\u8c61-Spread\u64cd\u4f5c\u7b26\n\/\/\u548crest\u64cd\u4f5c\u7b26\u5199\u6cd5\u4e00\u6837\uff0c\u4f7f\u7528\u4e09\u4e2a\u70b9...\n\/\/\u7528\u6765\u628a\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u6216\u8005\u6570\u7ec4\u7684\u5143\u7d20\u8fdb\u884c\u5206\u79bb,\u6216\u8005\u662f\u6269\u5c55\u4e3a\u5355\u4e2a\u9879\u76ee\n\/\/\u4e0erest\u64cd\u4f5c\u7b26\u76f8\u53cd\n\/\/\u6bd4\u5982\u6211\u53ef\u4ee5\u7528\u5b83\u6765\u514b\u9686\u51fa\u4e00\u4e2a\u5bf9\u8c61\n\/\/\u54b1\u4eec\u8fd9\u91cc\u5b9a\u4e49\u4e00\u4e2a\u5bf9\u8c61\n\nvar post = {\n    id:1,\n    title:&#039;\u6807\u98981&#039;,\n    content:&#039;\u8fd9\u662f\u5185\u5bb9&#039;,\n};\nconsole.log(post);\/\/{id: 1, title: &quot;\u6807\u98981&quot;, content: &quot;\u8fd9\u662f\u5185\u5bb9&quot;}\n\n\/\/\u6211\u4eec\u4f7f\u7528\u5bf9\u8c61post\u6765\u514b\u9686\u4e00\u4e2a\u65b0\u5bf9\u8c61\n\/\/\u4f7f\u7528spread\u64cd\u4f5c\u7b26\uff0c\u628a\u5b83\u7684\u5c5e\u6027\uff0c1\u4e2a1\u4e2a\u90fd\u62ff\u51fa\u6765\uff0c\u653e\u5230\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\u91cc\u9762\nvar postClone = {... post};\nconsole.log(postClone);\/\/{id: 1, title: &quot;\u6807\u98981&quot;, content: &quot;\u8fd9\u662f\u5185\u5bb9&quot;}\n\/\/\u503c\u662f\u4e00\u6837\u7684\uff0c\u4f46\u662f\u5b83\u4eec\u662f\u4e24\u4e2a\u4e0d\u540c\u7684\u5bf9\u8c61\uff0c\u5185\u5b58\u5730\u5740\u4e0d\u4e00\u6837\uff0c\u4e24\u4e2a\u4e0d\u540c\u7684\u5f15\u7528\nconsole.log(post===postClone);\/\/false\n\n\/\/\u57fa\u4e8e\u4e00\u4e2a\u5bf9\u8c61\u6dfb\u52a0\u65b0\u7684\u5c5e\u6027\nvar post2 = {\n    ...post,\n    author:&#039;\u5cf0\u534e&#039;,\n};\n\/\/\u901a\u8fc7\u67e5\u770b\uff0c\u65b0\u7684\u5c5e\u6027author:&#039;\u5cf0\u534e&#039;,\u5df2\u7ecf\u88ab\u6dfb\u52a0\u8fdb\u6765\nconsole.log(post2);\/\/{id: 1, titile: &quot;\u6807\u98981&quot;, content: &quot;\u8fd9\u662f\u5185\u5bb9&quot;, author: &quot;\u5cf0\u534e&quot;}\n\n\/\/Spread\u64cd\u4f5c\u7b26\u4e5f\u53ef\u4ee5\u7528\u5728\u6570\u7ec4\u4e2d\uff0c\n\/\/\u54b1\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u6570\u7ec4\u7684\u514b\u9686\uff0c\u4e5f\u53ef\u4ee5\u57fa\u4e8e\u5b83\u521b\u5efa\u4e00\u4e2a\u6709\u989d\u5916\u5143\u7d20\u7684\u65b0\u6570\u7ec4\nvar arr =[1,2,3];\nvar arrClone = [...arr];\nconsole.log(arrClone);\/\/(3)\u00a0[1, 2, 3]\n\/\/\u6dfb\u52a0\u65b0\u5c5e\u6027\uff0c\u64cd\u4f5c\u8ddf\u4e4b\u524d\u7684\u5bf9\u5bf9\u8c61\u8fdb\u884c\u7684\u64cd\u4f5c\u5dee\u4e0d\u591a\nvar arr2= [... arr,4,5,6];\nconsole.log(arr2);\/\/(6)\u00a0[1, 2, 3, 4, 5, 6]\n\n\/\/\u4e16\u754c\u4e0a\u6709\u90a3\u4e48\u591a\u4eba\u5728\u505a\u7740\u2018\u50bb\u4e8b\u2019\u4f46\u662f\u70ed\u7231\u7684\u4e8b\uff0c\u6211\u4e5f\u6dfb\u4e00\u4efd\u529b\u91cf\uff0c\u529b\u6240\u80fd\u53ca\u3002\n\/\/\u53e6\u5916\u5728\u51fd\u6570\u91cc\u9762\uff0c\u5982\u679c\u4e00\u4e2a\u51fd\u6570\u63a5\u6536\u591a\u4e2a\u53c2\u6570\uff0c\n\/\/\u53ef\u4ee5\u901a\u8fc7\u6570\u7ec4spreaad\u7684\u65b9\u5f0f\u4f20\u9012\u8fdb\u53bb\n\n\/\/\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u4fdd\u5b58\u535a\u6587\uff0c\u5b83\u9700\u89813\u4e2a\u53c2\u6570\uff0c\u7136\u540e\u7b80\u5355\u6a21\u62df\u5bf9\u53c2\u6570\u7684\u64cd\u4f5c\uff0c\u8fd9\u91cc\u7528\u6253\u5370\u51fa\u6765\u7684\u65b9\u5f0f\nfunction savePost(id,title,content){\n    console.log(&#039;\u4fdd\u5b58\u4e86:&#039;,id,title,content);\n}\n\/\/\u8c03\u7528savePost()\uff0c\u6211\u4eec\u53ef\u4ee5\u662f\u4f7f\u7528...[]\u7684\u6837\u5f0f\n\/\/spread\u64cd\u4f5c\u7b26\u53ef\u4ee5\u628a\u6570\u7ec4\u5206\u89e3\u4e3a3\u4e2a\u53c2\u6570\u4f20\u7ed9savePost(),\nsavePost(...[2,&#039;\u6807\u9898&#039;,&#039;\u5185\u5bb9\u5185\u5bb9&#039;]);\/\/\u4fdd\u5b58\u4e86: 1 2 3\n\/** *\/\n\n\/*P71-\u5bf9\u8c61-destructing\u548crest\n\/\/\u6570\u7ec4\u90a3\u8282\uff0c\u6211\u4eec\u4ecb\u7ecd\u4e86destructing\u548csignMent\u7ed3\u6784\u8d4b\u503c\n\/\/\u8fd8\u6709rest\u64cd\u4f5c\u7b26\n\/\/\u5b83\u4eec\u4e5f\u53ef\u4ee5\u7528\u5728\u5bf9\u8c61\u4e0a\u9762\n\n\/\/destructing\u548cassignMent\nvar post = {\n    id:1,\n    title:&#039;\u6807\u98981&#039;,\n    content:&#039;\u8fd9\u662f\u5185\u5bb9&#039;,\n};\n\n\/\/{}\u4e2d\u7684\u53d8\u91cf\u540d\uff0c\u9700\u8981\u548c\u5bf9\u8c61\u4e2d\u7684\u5c5e\u6027\u540d\u79f0\u4e00\u81f4\nvar {id, title} = post;\nconsole.log(id,title);\/\/1 &quot;\u6807\u98981&quot;\n\n\/\/\u522b\u540d\uff0c\u4f7f\u7528\u5192\u53f7\u63a5\u5728\u53d8\u91cf\u540d\u540e\u9762\nvar {id, title: headline} = post;\nconsole.log(id,headline);\/\/1 &quot;\u6807\u98981&quot;\n\n\/\/\u5b9a\u4e49\u9ed8\u8ba4\u503c\n\/\/\u9632\u6b62\u65e0\u6b64\u5c5e\u6027\uff0c\u6216\u503c\u4e3aundefined,\n\/\/\u4f46\u662f\u5982\u679c\u503c\u662fnull\uff0c\u5c31\u4e0d\u4f1a\u88ab\u9ed8\u8ba4\u503c\u66ff\u4ee3\uff0c\u56e0\u4e3anull\u672c\u8eab\u662f\u503c\nvar {id, title, comments = &#039;\u6ca1\u6709\u8bc4\u8bba&#039;} = post;\nconsole.log(comments);\/\/\u6ca1\u6709\u8bc4\u8bba\n\n\/\/\u6d4b\u8bd5\u6709\u5c5e\u6027\u4f46\u503c\u4e3anull\nvar post = {\n    id:1,\n    title:&#039;\u6807\u98981&#039;,\n    content:&#039;\u8fd9\u662f\u5185\u5bb9&#039;,\n    comments:null,\/\/\u589e\u52a0comments\u5c5e\u6027\uff0c\u8fd9\u91cc\u76f8\u8f83\u4e8e\u4e0a\u9762\u7684\u4f8b\u5b50\u7528\u7684post\u5bf9\u8c61\uff0c\n};\nvar {id, title, comments = &#039;\u6ca1\u6709\u8bc4\u8bba&#039;} = post;\nconsole.log(comments);\/\/null\n\n\/\/\u6570\u7ec4\u89e3\u6784\u8d4b\u503c\uff0c\u4e5f\u53ef\u4ee5\u6709\u9ed8\u8ba4\u503c\uff0cVH:\u4e0b\u4f8b\u662f\u6ca1\u6709\u5bf9\u5e94\u5143\u7d20\u4f7f\u7528\u9ed8\u8ba4\u503c\u7684\u60c5\u51b5,\u6570\u7ec4\u4f30\u8ba1\u4e0d\u4f1a\u51fa\u73b0\u6ca1\u6709\u5bf9\u5e94\u5c5e\u6027\u7684\u60c5\u51b5\nvar [a,b = 2]=[1];\nconsole.log(a,b);\/\/1 2\n\n\/\/\u7ed3\u5408\u6570\u7ec4\u548c\u5bf9\u8c61\u7684\u89e3\u6784\u8d4b\u503c\uff0c\u53ef\u4ee5\u89e3\u6784\u590d\u6742\u7684\u5bf9\u8c61\u7ed3\u6784\n\/\/\u6bd4\u5982\u4e0b\u9762\uff0c\u6211\u53ea\u60f3\u53d6comments\u5c5e\u6027\u4e2d\u7684\u7b2c\u4e8c\u7ec4\u4e2d\u7684coment\u7684\u503c\nvar post2 = {\n    id:2,\n    title:&#039;\u6807\u98982&#039;,\n    content:&#039;\u8fd9\u662f\u5185\u5bb9&#039;,\n    comments:[\n        {\n            userId:1,\n            comment:&#039;\u8bc4\u8bba1&#039;,\n        },\n        {\n            userId:2,\n            comment:&#039;\u8bc4\u8bba2&#039;,\n        },\n        {\n            userId:3,\n            comment:&#039;\u8bc4\u8bba3&#039;,\n        },\n    ],\n};\nvar{comments:[,{comment}]} = post2;\nconsole.log(comment);\/\/\u8bc4\u8bba2\n\n\/\/\u89c9\u5f97\u6f2b\u957f\u662f\u56e0\u4e3a\u96be\u8fc7\uff0c\u662f\u56e0\u4e3a\u6c42\u800c\u4e0d\u5f97\u3002\u662f\u56e0\u4e3a\u81ea\u5df1\u8d44\u5386\u4e0d\u591f\uff01\n\/\/\u676d\u5dde\u7684\u65e5\u5b50\u975e\u5e38\u7684\u5feb\uff01\uff01\uff01\u4e0a\u5929\u4e5f\u662f\u7737\u987e\u6211\uff01\n\n\/\/\u89e3\u6784\u7684\u65f6\u5019\uff0c\u53ef\u80fdkey\u662f\u52a8\u6001\u7684\uff0c\u662f\u4e2a\u53d8\u91cf\u3002\n\/\/\u53ef\u4ee5\u7528\u65b9\u62ec\u53f7\u628a\u53d8\u91cf\u540d\u62ec\u8d77\u6765\uff0c\u4f5c\u4e3akey\/\/\u662f\u4e0d\u662f\u4e0d\u80fd\u7528\u53d8\u91cf\u7684\u503c\u5f53\u505a\u53e6\u4e00\u4e2a\u53d8\u91cf\u540d\n\/\/VH\uff1a\u7ecf\u8fc7\u540e\u9762\u6d4b\u8bd5\uff0c\u5fc5\u987b\u4f7f\u7528[]\u548c\u522b\u540d\u7684\u65b9\u5f0f\uff01\nfunction getId(idKey,obj){\n    let{[idKey]: id } = obj;\n    return id;\n}\nconsole.log(getId(&#039;userId&#039;,{userId:3}));\/\/3\n\n\/\/\u6d4b\u8bd5\uff0c\u8fd9\u5c31\u5f88\u5947\u602a\uff011.\u4e3a\u5565\u7528[]2.\u4e3a\u5565\u7528\u522b\u540d\uff1f\n\/\/\u4e0d\u4f7f\u7528[],\u8bed\u53e5\u6807\u8bb0650\uff1aUncaught SyntaxError: Identifier &#039;idKey&#039; has already been declared\n\/\/\u56e0\u4e3a\u548c\u53c2\u6570\u4e2d\u7684idKey\u91cd\u590d\u4e86\u3002\u53c2\u6570\u7684idKey\u6539\u6210idKey1\u5c31\u6ca1\u6709\u9519\u8bef\uff0c\u4f46\u662f\u7ed3\u679cundefined\n\/\/\u4e3a\u5565\u4e0d\u884c\u5462\uff1f\u4e4b\u524d\u7684\u65f6\u5019\u53c2\u6570\u5728\u51fd\u6570\u91cc\u7684\u4f5c\u7528\u662f\u4f5c\u4e3a\u53d8\u91cf\uff0c\u8fd9\u91cc\u662f\u4f5c\u4e3a\u53d8\u91cf\u540d\uff0c\u6240\u4ee5\uff0clet{[idKey]: id } = obj;\n\/\/ function getId(idKey,obj){\n\/\/     let{idKey} = obj;\/\/\u6807\u8bb0650\n\/\/     return idKey;\n\/\/ }\n\/\/ console.log(getId(&#039;userId&#039;,{userId:3}));\/\/3\n\/\/\u90a3\u4e48\u4e0d\u7528\u522b\u540d\u884c\u4e0d\u884c\uff1f\u4e0d\u884c\u3002\u5199\u5b8c\uff0c\u5f53\u65f6VScode\u5c31\u5728let{[idKey]}\u672b\u5c3e\u5904\u4e0b\u5212\u6ce2\u6d6a\u7ebf\u63d0\u793a\u6709\u95ee\u9898\uff0c\u8fd0\u884c\u62a5\u9519\/\/Uncaught SyntaxError: Unexpected token &#039;}&#039;\n\/\/ function getId(idKey,obj){\n\/\/     let{[idKey]} = obj;\/\/Uncaught SyntaxError: Unexpected token &#039;}&#039;\n\/\/     return [idKey];\n\/\/ }\n\/\/ console.log(getId(&#039;userId&#039;,{userId:3}));\/\/3\n\n\/\/rest\u64cd\u4f5c\u548c\u6570\u7ec4\u4e00\u6837\n\/\/\u5269\u4f59\u7684\u53ef\u4ee5\u5f53\u505a\u5b50\u5bf9\u8c61\u8fd4\u56de\u56de\u6765\n\nvar {comments, ...rest} = post2;\nconsole.log(rest);\/\/{id: 2, title: &quot;\u6807\u98982&quot;, content: &quot;\u8fd9\u662f\u5185\u5bb9&quot;}\nconsole.log(post2);\/\/\u539f\u5bf9\u8c61\u672a\u53d7\u5f71\u54cd\n\/\/VH:\u4e0a\u9762\u90a3\u6837\u590d\u6742\u70b9\u7684\u5462\uff1f\u7ed3\u679c\u548c\u4e0a\u9762\u4e00\u6837\uff0c\u53ea\u8ba4\u7b2c\u4e00\u5c42\u7684\nvar{comments:[,{comment}],...rest} = post2;\nconsole.log(rest);\/\/{id: 2, title: &quot;\u6807\u98982&quot;, content: &quot;\u8fd9\u662f\u5185\u5bb9&quot;}\n\n\/\/\u89e3\u6784\u548crest\u64cd\u4f5c\u7b26\u8fd8\u53ef\u4ee5\u4f5c\u4e3a\u51fd\u6570\u5230\u53c2\u6570\uff0c\n\/\/\u7ed3\u6784\u64cd\u4f5c\u8ba9\u5bf9\u8c61\u5143\u7d20\u76f4\u63a5\u4f5c\u4e3a\u53c2\u6570\nfunction savePostObj({id, title, content}){\n    console.log(&#039;\u4fdd\u5b58\u4e86\u6587\u7ae0\uff1a&#039;, id, title, content);\/\/\u6807\u8bb0674\n}\nsavePostObj({id: 4, title:&#039;\u6807\u98984&#039;, content:&#039;\u5185\u5bb94&#039;});\/\/index.js:674\u4fdd\u5b58\u4e86\u6587\u7ae0\uff1a 4 \u6807\u98984 \u5185\u5bb94\n\n\/\/\u6dfb\u52a0...rest,\u51fd\u6570\u4f53\u5185\u4f7f\u7528rest\uff0c\u8fd9\u65f6savePostObj\u6539\u6210savePostObj2\nfunction savePostObj2({id, title, content, ...rest }){\n    console.log(&#039;\u4fdd\u5b58\u4e86\u6587\u7ae0\uff1a&#039;, id, title, content);\/\/\u6807\u8bb0684\n    console.log(rest);\n}\nsavePostObj2({id: 4, title:&#039;\u6807\u98984&#039;, content:&#039;\u5185\u5bb94&#039;,author:&#039;\u5cf0\u534e&#039;});\/\/index.js:684 \u4fdd\u5b58\u4e86\u6587\u7ae0\uff1a 4 \u6807\u98984 \u5185\u5bb94\n\/\/output\uff1a\n\/\/\u4fdd\u5b58\u4e86\u6587\u7ae0\uff1a 4 \u6807\u98984 \u5185\u5bb94\n\/\/{author: &quot;\u5cf0\u534e&quot;}\n\/\/     author: &quot;\u5cf0\u534e&quot;\n\/\/     __proto__: Object\n\/\/end\n\/** *\/\n\n\/*P72-\u5bf9\u8c61-\u503c\u4f20\u9012\u548c\u5f15\u7528\u4f20\u9012\n\/\/Array\u548cObject\u5728\u51fd\u6570\u7684\u53c2\u6570\u4e2d\u662f\u6309\u5f15\u7528\u4f20\u9012\u7684\n\/\/\u4e5f\u5c31\u662f\u8bf4\u5b83\u4f20\u9012\u7684\u662f\u5185\u5b58\u5730\u5740\uff0c\u54b1\u4eec\u4fee\u6539\u5b83\u7684\u503c\u4e4b\u540e\uff0c\u6240\u6709\u7528\u5230\u8be5\u5730\u5740\u7684\u503c\u90fd\u4f1a\u53d8\u5316\n\/\/\u4e0d\u8fc7\uff0c\u6570\u5b57\u548c\u5e03\u5c14\u7b49\u57fa\u672c\u7c7b\u578b\u662f\u6309\u503c\u4f20\u9012\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u5b83\u7684\u503c\u4f1a\u88ab\u590d\u5236\u4e00\u4efd\u65b0\u7684\n\/\/\u5728\u51fd\u6570\u4e2d\u4fee\u6539\u5b83\u7684\u503c\u4e4b\u540e\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5b83\u4e4b\u524d\u7684\u503c\n\n\/\/\u4f8b\u5b50\uff1a\u6309\u5f15\u7528\u4f20\u9012\n\/\/=&gt;\u6570\u7ec4\nfunction byReference(arr){\n    arr[0] = 5;\n}\nvar array = [1,2,3];\nbyReference(array);\nconsole.log(array);\/\/(3)\u00a0[5, 2, 3]\n\n\/\/=&gt;\u5bf9\u8c61\uff1apost\u5bf9\u8c61\u7684title\u662f\u5f15\u7528\u4f4d\u7f6e\uff0c\u6539\u52a81\u5904\u5904\u5904\u8c03\u7528\u53d8\u52a8\uff0c\u53d8\u6210\u4e86\u2018\u6807\u9898\u6807\u9898\u2019\nfunction byReferenceObj(obj){\n    obj.title = &#039;\u6807\u9898\u6807\u9898&#039;;\n}\nvar post ={id:1,title:&#039;\u6807\u9898&#039;};\nbyReferenceObj(post);\nconsole.log(post);\/\/{id: 1, title: &quot;\u6807\u9898\u6807\u9898&quot;}\n\n\/\/\u4f8b\u5b50\uff1a\u6309\u503c\u4f20\u9012\n\/\/=&gt;\u5b57\u7b26\u4e32:\u5b57\u7b26\u4e32\u6bd4\u8f83\u7279\u6b8a\uff0c\u867d\u7136\u662f\u6309\u5f15\u7528\u4f20\u9012\u7684\uff0c\u4f46\u662f\u5b83\u6bcf\u6b21\u88ab\u8d4b\u503c\u7684\u65f6\u5019\uff0c\u90fd\u662f\u521b\u5efa\u4e00\u4e2a\u65b0\u7684string\u5bf9\u8c61\uff0c\u65e7\u7684\u4e0d\u4f1a\u6539\u53d8\u3002\n\/\/VH\uff1a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u6ca1\u6709\u88ab str= &#039;abc&#039;;\u8d4b\u503c\u4e3a&#039;abc&#039; str= &#039;abc&#039;\u8fd8\u662f\u81ea\u5df1\u7684\u503c&#039;test&#039;\u3002\nfunction byReferenceStr(str){\n    str= &#039;abc&#039;;\/\/\u8fd0\u884c\u5230\u8fd9\u91cc\uff0c\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u5bf9\u8c61\uff0c\u6ca1\u6709\u6539\u53d8testStr\n    console.log(str);\/\/abc\n}\nvar testStr = &#039;test&#039;;\nbyReferenceStr(testStr);\nconsole.log(testStr);\/\/test\n\n\/\/=\u300b\nfunction byValue(num){\n    num = 10;\n    console.log(num);\/\/10\n}\nvar testNum =1;\nbyValue(testNum);\nconsole.log(testNum);\/\/1\/\/\u8bf4\u660e\u51fd\u6570\u590d\u5236\u4e00\u4efdtestNum\u6765\u4f7f\u7528\uff0c\u6ca1\u6709\u6539\u53d8\u5916\u90e8testNum\u7684\u503c\u3002\n\n\/** *\/\n\n\/*P73-\u5bf9\u8c61-call&amp;apply&amp;bind\n\/\/call, apply \u548cbind\u90fd\u53ef\u4ee5\u7528\u6765\u6539\u53d8\u51fd\u6570\u4e2dthis\u7684\u6307\u5411\uff0c\n\/\/\u4e0d\u8fc7\u5b83\u4eec\u6709\u4e00\u4e9b\u7ec6\u5fae\u7684\u5dee\u522b\n\nconsole.clear();\n\/\/\u6bd4\u5982\u6211\u8fd9\u91cc\u5b9a\u4e49\u4e00\u4e2a\u5458\u5de5\u5bf9\u8c61\n\/\/emp\u5bf9\u8c61\u7684printInfo()\u65b9\u6cd5\u4e2d\u7684this.name\u6307\u7684\u662femp\u7684name\u5c5e\u6027\n\/\/\u5c5e\u6027department\u7684\u5c5e\u6027\u53c8\u6709\u5bf9\u8c61\uff0c\u90a3\u4e48department\u4e2d\u7684printInfo\u4e2dthis.name\u6307\u7684\u662fdepartment\u7684name\nvar emp = {\n    id:1,\n    name:&#039;\u5cf0\u534e&#039;,\n    printInfo(){\n        console.log(&#039;\u5458\u5de5\u59d3\u540d\uff1a&#039;+this.name);\n    },\n    department:{\n        name:&#039;\u6280\u672f\u90e8&#039;,\n        printInfo(){\n            console.log(&#039;\u90e8\u95e8\u540d\u79f0\uff1a&#039;+this.name);\n        }\n    }\n};\nemp.printInfo();\/\/\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e\nemp.department.printInfo();\/\/\u90e8\u95e8\u540d\u79f0\uff1a\u6280\u672f\u90e8\n\/\/\u5176\u5b9eprintInfo()\u4e2d\u7684this\u6307\u5411\u7684\u662f\u5de6\u8fb9\u7684\u5bf9\u8c61,\u7b2c\u4e00\u4e2a\u5de6\u8fb9\u662femp\uff0c\u7b2c\u4e8c\u4e2a\u5de6\u8fb9\u662fdepartmnet\n\/\/\u4ee5\u4e0athis\u662f\u9ed8\u8ba4\u7ed1\u5b9a\u7684\uff0c\u6211\u4eec\u4e0d\u9700\u8981\u7279\u522b\u7684\u64cd\u4f5c\n\/** *\/\n\n\/*call\u7684\u7528\u6cd5\n\/\/\u5982\u679c\u6211\u628aprintInfo\u5355\u72ec\u62ff\u51fa\u6765\uff0c\nvar emp = {\n    id:1,\n    name:&#039;\u5cf0\u534e&#039;,\n};\n\nfunction printInfo(){\n    console.log(&#039;\u5458\u5de5\u59d3\u540d\uff1a&#039;+this.name);\/\/\u6807\u8bb0774\n}\n\n\/\/printInfo()\u76f4\u63a5\u8c03\u7528\uff0c\u5176\u4e2dthis\u6307\u5411window\u5bf9\u8c61\uff0c\u5b83\u91cc\u9762\u6ca1\u6709name\u8fd9\u4e2a\u5c5e\u6027\n\/\/VH\uff1a\u56e0\u4e3a\u6211\u6d4b\u8bd5\u8c03\u7528\u5c31\u9519\u8bef\uff0c\u6240\u4ee5\u53ea\u80fd\/\/\u6ce8\u91ca\u4e0b\u9762\u8fd9\u884c\n\/\/VH\uff1a\u6ce8\u610f\uff0c\u8001\u5e08\u8bfe\u5802\u89c6\u9891\u4e2d\uff0c\u6253\u5370\u7ed3\u679c\u6ca1\u6709\u62a5\u9519\uff1a\u3010\u5458\u5de5\u59d3\u540d\uff1a\u3011\uff0c\u4f30\u8ba1\u8001\u5e08vscode\u4e2d\u662f\u4e0a\u9762\u67d0\u4e2a\u5730\u65b9\u6709name\u53d8\u91cf\uff0c\u4f46\u662f\u503c\u4e3a\u7a7a\n\/\/ printInfo();\/\/\u6807\u8bb0778 \n\/\/output\n\/\/ Uncaught TypeError: Cannot read property &#039;name&#039; of undefined\n\/\/     at printInfo (index.js:774)\n\/\/     at index.js:778\n\/\/end\n\n\/\/\u4f7f\u7528call\u65b9\u6cd5\uff0c\u663e\u5f0f\u5730\u7ed9printInfo\u7ed1\u5b9a\u4e00\u4e2athis\u6307\u5411\nprintInfo.call(emp);\/\/\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e\uff08index.js:774\uff09\n\/** *\/\n\n\/*call\uff0capply\u7684\u533a\u522b\uff0cbind\u65b9\u6cd5\n\/\/\u5e26\u53c2\u6570\u7684\u51fd\u6570\u4f7f\u7528call\u548capply\nvar emp = {\n    id:1,\n    name:&#039;\u5cf0\u534e&#039;,\n};\n\/\/\u7ed9printInfo\u6dfb\u52a0\u989d\u5916\u7684\u53c2\u6570\nfunction printInfo(dep1,dep2,dep3){\n    console.log(&#039;\u5458\u5de5\u59d3\u540d\uff1a&#039;+this.name, dep1,dep2,dep3);\/\/\u6807\u8bb0774\n}\n\/\/call\u4f7f\u7528\u65f6\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u9700\u8981\u7ed1\u5b9a\u7684\u5bf9\u8c61\uff0c\u540e\u7eed\u53c2\u6570\u4f9d\u6b21\u5c31\u662f\u51fd\u6570\u5b9a\u4e49\u65f6\u5b9a\u4e49\u7684\u53c2\u6570\nprintInfo.call(emp, &#039;\u6280\u672f\u90e8&#039;,&#039;IT\u4e8b\u4e1a\u90e8&#039;,&#039;\u603b\u88c1\u529e\u516c\u5ba4&#039;);\/\/\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e \u6280\u672f\u90e8 IT\u4e8b\u4e1a\u90e8 \u603b\u88c1\u529e\u516c\u5ba4\n\n\/\/apply\u53ef\u4ee5\u4f7f\u7528\u6570\u7ec4\u5f62\u5f0f\u7684\u53c2\u6570\uff0c\u4e00\u6b21\u628a\u53c2\u6570\u4f20\u9012\u8fdb\u53bb\uff0c\u6570\u7ec4\u5185\u7684\u5143\u7d20\u987a\u5e8f\u4e0e\u51fd\u6570\u5b9a\u4e49\u65f6\u6b21\u5e8f\u4e00\u81f4\nprintInfo.apply(emp,[&#039;\u6280\u672f\u90e8&#039;,&#039;IT\u4e8b\u4e1a\u90e8&#039;,&#039;\u603b\u88c1\u529e\u516c\u5ba4&#039;]);\/\/\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e \u6280\u672f\u90e8 IT\u4e8b\u4e1a\u90e8 \u603b\u88c1\u529e\u516c\u5ba4\n\nconsole.clear;\n\/\/bind\u64cd\u4f5c\u4e0ecall\u4e00\u6837\uff0c\u9700\u8981\u53c2\u6570\u5217\u8868\uff0c\n\/\/\u4e0d\u540c\u7684\u662f\u800c\u662f\u8fd4\u56de\u4e00\u4e2a\u6539\u53d8\u4e86this\u6307\u5411\u7684\u65b0\u51fd\u6570\uff0c\u4e0d\u4f1a\u9a6c\u4e0a\u6267\u884c\uff0c\u7528\u4e8e\u540e\u7eed\u6267\u884c\n\/\/\u53ef\u4ee5\u7528\u53d8\u91cf\u63a5\u6536\u8fd9\u4e2a\u65b0\u51fd\u6570\uff0c\u5728\u540e\u9762\u8c03\u7528\nvar empPrintInfo = printInfo.bind(emp,&#039;\u6280\u672f\u90e8&#039;,&#039;IT\u4e8b\u4e1a\u90e8&#039;,&#039;\u603b\u88c1\u529e\u516c\u5ba4&#039;);\nempPrintInfo();\/\/\u5458\u5de5\u59d3\u540d\uff1a\u5cf0\u534e \u6280\u672f\u90e8 IT\u4e8b\u4e1a\u90e8 \u603b\u88c1\u529e\u516c\u5ba4\n\n\/** *\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/*P58-\u5bf9\u8c61-\u521b\u5efa\u5bf9\u8c61 \/\/JS\u7684\u8bbe\u8ba1\u89c4\u8303\u57fa\u4e8e\u5bf9\u8c61\u539f\u578b\u7684\uff0c\u4e0e\u5176\u4ed6\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\u7c7b\u4f3c\uff0c\u4f46\u66f4\u7075\u6d3b\u3002 \/\/\u63cf\u8ff0\u5ba2\u89c2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"_links":{"self":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/912"}],"collection":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/comments?post=912"}],"version-history":[{"count":1,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/912\/revisions"}],"predecessor-version":[{"id":913,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/posts\/912\/revisions\/913"}],"wp:attachment":[{"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/media?parent=912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/categories?post=912"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.henrycome.com\/wordpress\/wp-json\/wp\/v2\/tags?post=912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}