Hook constructor Object - Javascript Object

Javascript examples for Object:Constructor

Description

Hook constructor Object

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//ww w.  ja v a  2  s  .c  o m
if (typeof Object.make !== 'function') {
    Object.make = function (o) {
        for(key in o) {
            if(o.hasOwnProperty(key))
                console.log( key + ' ' + o[key]);
        }
        return o;
    };
}
var MyObj = Object.make({ a: 1});
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials