Javascript continue Statement Skip for loop

Introduction

Using the continue statement in a for statement.

for ( let count = 1; count <= 10; ++count )
{
   if ( count == 5 )
      continue; // skip remaining loop code only if count == 5
   console.log( "Count is: " + count + "<br />" );
}

console.log( "Used continue to skip printing 5" );



PreviousNext

Related