eval()
eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DEMO - Lik</title> </head> <body> </body> <script> eval("x=10;y=20;document.write(x*y)") // 输出 200 document.write(eval("2+2")) // 输出 4 var x=10 document.write(eval(x+10)) // 输出 20 </script> </html>
author:Lik
Endeavoring to powerless, struggling to move yourself.
Endeavoring to powerless, struggling to move yourself.