Javascript examples for Object:prototype
Get prototype of an object initialized with {}
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w ww . j a v a 2 s . c o m var foo = {}; foo.constructor.prototype.field1='FOO'; foo.constructor.prototype.method1=function(){ console.log(this.field1)}; var bar={field1:'this is a test'}; bar.prototype=Object.create(foo); bar.method1(); } </script> </head> <body> </body> </html>