処理時間の計測
処理時間の計測には、console.time()とconsole.timeEnd()を用いることができる。
| 1 2 3 4 5 6 7 8 | console.time( "timer" ); var n = 0; while ( n < 1000000 ) {   n++; } console.timeEnd( "timer" ); | 
コールスタック・オーバーフロー
再帰のネストが深すぎると、コールスタック・オーバーフローが発生する。
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function countdown( n ) {   if ( n == 0 ) {     console.log( "end" );   } else {     n--;     countdown( n - 1 );   } } console.log( "start" ); countdown( 100000 ); // 実行結果 // start // Uncaught RangeError: Maximum call stack size exceeded | 
これを回避する方法の一つとして、setTimeout()関数による方法がある。