Extract numbers and operators out of an array in order - Javascript Array

Javascript examples for Array:join

Description

Extract numbers and operators out of an array in order

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(){//  www. j  a va 2s  . co m

var newArray = ["5", "*", "1"]
var output = eval(newArray.join(""))
console.log(output)


    }

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

Related Tutorials