function add(){
          //这里放要执行的代码
    }
//开始测试并输出
        function test()
        {
        var start=new Date().getTime();
        add();
        var end=new Date().getTime();
        return (end-start)+"ms";
        }
        var time=test(add);
        alert(time);

 

相关文章: