1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| const
iLength = 3,
datas = [ 'te', 'mesure_id', 'gtw_id', 'rssi' ],
jLength = datas.length,
arrDataTe = Array.from( new Array( iLength ), ( item, i ) => Array.from( new Array( jLength ), ( jtem, j ) => datas[ j ] ) );
// debug, console, touche F12
for ( let [ i, item ] of arrDataTe.entries() ){
console.log( i, item );
for ( let [ j, jtem ] of item.entries() ){
console.log( `[ ${i}, ${j} ] : ${ jtem }` );
}
}
/*
0 (4) ["te", "mesure_id", "gtw_id", "rssi"]
[ 0, 0 ] : te
[ 0, 1 ] : mesure_id
[ 0, 2 ] : gtw_id
[ 0, 3 ] : rssi
1 (4) ["te", "mesure_id", "gtw_id", "rssi"]
[ 1, 0 ] : te
[ 1, 1 ] : mesure_id
[ 1, 2 ] : gtw_id
[ 1, 3 ] : rssi
2 (4) ["te", "mesure_id", "gtw_id", "rssi"]
[ 2, 0 ] : te
[ 2, 1 ] : mesure_id
[ 2, 2 ] : gtw_id
[ 2, 3 ] : rssi
*/ |