Javascript examples for Object:Constructor
Using Object.create instead of Constructors for inheritance
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w. j ava 2s. com var my = Object.create( Object.prototype, { oldProp: { value: 'new value', writable: true, enumerable: true} }); my.oldProp = "this is a test"; console.log(my.oldProp); for (var k in my) console.log(my[k]); } </script> </head> <body> </body> </html>