A Pen by ClaudiaInBytes on CodePen.
Created
June 22, 2017 02:24
-
-
Save claudiainbytes/5fbe0a475e716b4515de29e7e691c7df to your computer and use it in GitHub Desktop.
JS - Labeling loops/Rotulación de ciclos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var abc = "a,b,c,d,e,f,g,h,i,j,k,l"; | |
abc = abc.split(","); | |
c = 0; | |
var matrix = []; | |
for (var i = 0; i < 3; i++){ | |
var fila = []; | |
for(var j = 0; j < 4; j++){ | |
fila[j] = abc[c]; | |
c++; | |
} | |
matrix[i] = fila; | |
} | |
console.log(matrix); | |
var matrix2 = []; | |
for_label_principal: | |
for (var i = 0; i < 3; i++){ | |
var fila2 = []; | |
for(var j = 0; j < 4; j++){ | |
fila2.push(matrix[i][j]); | |
if( j == 1 ){ | |
continue for_label_principal; | |
} | |
matrix2.push(fila2); | |
} | |
} | |
console.log(matrix2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment