1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>함수를 인수로서 전달하기</title> </head> <body> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script> function benchmark(proc) { var start = new Date(); proc(); var end = new Date(); return end.getTime() - start.getTime(); } console.log( benchmark(function() { var x = 15; for(var i=0; i<10000000; i++) { x *= i; } }) ); </script> </body> </html> |
댓글 없음:
댓글 쓰기