Convert array values into strings in javascript - Javascript Array Operation

Javascript examples for Array Operation:Array Convert

Description

Convert array values into strings in javascript

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(){/*w w w. ja v a  2s  .  co  m*/
//var abc = 2;
//var xyz = "test";
//var rpq = new Date();
var obj = {
    ABC: 1,
    QWE: "test",
    ZYX: new Date()
};
var arr = [];
for (var key in obj){
    console.log(key, obj[key]);
    arr.push(String(key));
}
console.log(arr);
    }

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

Related Tutorials