Skip to content Skip to sidebar Skip to footer

Javascript: Goto Statement

I have a for loop, but in one condition, I want to skip some steps so that I have used goto statement... for (var rows = 0; rows < result.data.length; rows++) { [lbl] topOfLoo

Solution 1:

Pretty sure you want to use continue;:

for (var rows = 0; rows < result.data.length; rows++)  {
    var row = result.data[rows];
    if (row[0] == "") {
        continue;  
    }
    // some code
}

Solution 2:

i want to skip some steps so that i'v used goto statement...

Use continue statement instead of goto

for (var rows = 0; rows < result.data.length; rows++) 
    {
        var row = result.data[rows]
        if (row[0] == "") 
        {
           continue;
        }

Solution 3:

Use continue statement in your code;

The continue statement passes control to the next iteration of the enclosing iteration statement in which it appears.

It is one of the Jump statements.

if (row[0] == "")
{
     continue;  
}

Post a Comment for "Javascript: Goto Statement"