- var runtime = {
- start : function() {
- this.startTime = new Date();
- },
- end : function() {
- return (new Date() - this.startTime);
- }
- };
- runtime.start();
- var html = '';
- for (var i=0; i<1000; i++) {
- html += i+'cxcxcxcxcxcxcxc<br />';
- }
- document.body.innerHTML += html;
- alert(runtime.end()); //单位ms
- //该片段来自于http://www.codesnippet.cn/detail/291020136756.html
来源: http://www.codesnippet.cn/detail/291020136756.html