Add quotation marks to key-value object - Javascript Object

Javascript examples for Object:Object Literal

Description

Add quotation marks to key-value 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(){/*from  w  w  w. ja v  a 2 s  . c o  m*/
    
var test=new Object();
test.position="4";
for (var prop in test) {
    test[prop]="\""+test[prop]+"\"";
    console.log(prop + " = " + test[prop]);
}

    }

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

Related Tutorials