Javascript examples for Object:prototype
Object prototype from instance
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from ww w .j a v a 2 s. co m var a = { n: 8, myObj: { i: 7 }}; var b = Object.create(a); b.n = 10; console.log(a.n); // still 8 console.log(b.n); // 10 b.myObj.i = 15; console.log(a.myObj.i); // changed to 15! console.log(b.myObj.i); // 15 } </script> </head> <body> </body> </html>