惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - Bruce Tang

SAP模块一句话入门(专业术语的理解) SAP订单结算详解 SAP Datasheet - The Best Online SAP Object Repository ASP.NET MVC5 网站开发实践 VMware S/4 HANA OP 1511虚拟机下载,64G内存限制解决方案 SAP标准教材列表 SAP文章链接 正则表达式30分钟入门教程 SAP ECC6 IDES安装及虚拟机下载 安装完SAP后BASIS的配置流程 常用软件下载 最全的微软msdn原版windows系统镜像和office下载地址集锦 常用WinPE Friends(老友记)(六人行)相关资源 SAP初级书籍(PM相关) iframe自适应宽度和高度 Win7下的IE10正式版下载地址 JQUERY作者JOHN RESIG自己封装的常用函数 VS2010的JS和CSS折叠插件[JSEnhancements]
动态执行javascript代码
Bruce Tang · 2013-04-12 · via 博客园 - Bruce Tang

动态执行javascript代码,eval or Function,哪个性能好?

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>动态执行javascript代码</title>
<script type="text/javascript">
    String.prototype.code = function(){
        return (new Function('with(this) { return ' + this + '}' )).call({});
    };

    var sCode = 'Math.round(3+2.5)*1.2';

    var result = 0;
    for(var i=0;i<10000;i++){
        result += sCode.code();
        //result += eval(sCode);
    }
    alert(result);
</script>
</head>
<body>

</body>
</html>