Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
BlueHost Web Hosting

Bonsai Boy of New York Bonsai Trees and Accessories

Liquid Web iThemes WordPress Hosting

Website Domains Names & Hosting | Domain.com

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


getResponse autofunnels

Liquid Web Cloud VPS Hosting

Disclosure We are a professional Information website that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

12,195 questions

16,607 answers

573 users

How to evaluates or execute JavaScript code represented as a argument string in JavaScript

9 Answers

0 votes
  <script type="text/JavaScript"> 
    
    var a = 100;
    var b = 1;

    document.write(eval("a + b + 99"));
    
    /*
    run
    
    200 
    
    */
  
  </script>

 




answered Jul 24, 2016 by avibootz
0 votes
  <script type="text/JavaScript"> 
    
    var c = "31";

    document.write(eval("c"));
    
    /*
    run
    
    31  
    
    */
  
  </script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = "2";
var b = "3";

document.write(eval("a * b"));

/*
run

6 

*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = "2";
var b = "3";
 
document.write(eval("7 * 7"));
 
/*
run
 
49  
 
*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = "2";
var b = "3";

document.write(eval("7 * b"));

/*
run

21   

*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = "2";
var b = "3";
 
document.write(eval(new String("3 + 5")));
 
/*
run
 
3 + 5   
 
*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var s = "if ( a ) { 2 + 2; } else { 3 + 3; }";
var a = true;

document.write(eval(s));
 
/*
run
 
4   
 
*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = 10;
var s = "if (a == 10) {x = 100;} else x = 0;";


document.write(eval(s));
 
/*
run
 
100   
 
*/

</script>

 




answered Jul 24, 2016 by avibootz
0 votes
<script type="text/JavaScript"> 

var a = 10;
var s = "if (a == 10) {document.write('a = 10 and '); x = 100;} else x = 0;";


document.write(eval(s));
 
/*
run
 
a = 10 and 100    
 
*/

</script>

 




answered Jul 24, 2016 by avibootz
...