b对象变为a对象的父亲
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>sss</title> </head> <body> <script type="text/javascript"> let a = { name:"hhhh" }; let b = { url :"zzzzzzzzzzzzz" }; Object.setPrototypeOf(a,b); console.log(a); /* Objectname: "hhhh" __proto__: url: "zzzzzzzzzzzzz" __proto__: Object */ </script> </body> </html>