Set key and from variable in one line - Javascript Object

Javascript examples for Object:Object Literal

Description

Set key and from variable in one line

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(){/*from w w  w.  j a  v  a  2s. co m*/
function myFunction(opts){
 console.log(opts);
}
var  options = {}
  ,  key = "foo", value = "bar"
  ;
myFunction(new function(){this[key]=value;});
    }

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

Related Tutorials