Reputation: 23
these loops are iterating through arrays.
arrayFinalValues = [];
$(arrayAccessRightID).each(function (i, val) {
$(arrayNodeID).each(function (j, val1) {
arrayFinalValues.push(val);
arrayFinalValues.push(val1);
$(arraySelectedValues).each(function (k, val2) {
arrayFinalValues.push(val2);
if (arrayFinalValues.length % 6 == 0)
return false;
});
});
});
in the inner most loop when six elements are entered i want again to start from the outermost loop and in the inner most loop the index should start from next 4th element i.e., i want to in the structure 1,1,T,T,F,F,1,2,F,F,F,F. and so on. that is in the inner most loop the index should start from next elements.when i use return false in inner most loop it again starts with 0.i tried labels but its now working.
Upvotes: 0
Views: 258
Reputation: 47784
Try this, taken from here
$(arrayAccessRightID).each(function (i, val) {
var shouldExit = true;
$(arrayNodeID).each(function (j, val1) {
arrayFinalValues.push(val);
arrayFinalValues.push(val1);
$(arraySelectedValues).each(function (k, val2) {
arrayFinalValues.push(val2);
if (arrayFinalValues.length % 6 == 0)
{
shouldExit = false;
return shouldExit;
}
});
return shouldExit;
});
return shouldExit;
});
Upvotes: 2