If I have the following code
Arreglo.each(function() {
if(micondicion)
return false;
}
Exits the cycle, How can I continue with the next one?
If I have the following code
Arreglo.each(function() {
if(micondicion)
return false;
}
Exits the cycle, How can I continue with the next one?
According to the jQuery documentation return any value not false is equivalent to doing continue
, so you can return true
, 1
, "cadena"
$.each(arr, function() {
if(continuar) {
return true; // cualquier valor no falso
}
});
To make the code more readable you can place a return "continue";
, the idea is that your code clearly indicates the purpose of that line.
Use return true
;
For example:
Arreglo.each(function() {
if(micondicion)
return true;
}); // Faltó cerrar función