Create Object with object literal - Javascript Object

Javascript examples for Object:Object Literal

Description

Create Object with object literal

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>SO - 28710580</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script type="text/javascript">
function x() {/* w ww.  ja v a 2 s . c  o  m*/
    var obj = {
        price208: '23432',
        price308: '123'
    }
    var model = '208';
    console.log(obj['price' + model])
}
x();

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

Related Tutorials