HTML
JavaScript For Loop for (初始表達式 ; 條件式 ; 遞增表達式 ) { 陳述式 代碼塊 } Example : for (var i = 0; i < 5; i++) { text += i } // 01234
JavaScript do...while Loop do { code block to be executed 陳述式 代碼塊 } while (condition 條件式); Example : <script> var text = ""; var i = 0; do { text += i + " "; i++;} while (i < 5); document.write( text ) </script>
JavaScript while Loop while ( 條件式 ) { 陳述式 代碼塊 遞增表達式} Example : <script> var text = ""; var i = 0; while (i < 5) { text += i + " "; i++;} document.write( text ) </script>
沒有留言:
張貼留言