Hi !
Learning step by step to use and manipulate arrays...
So... this time, i finally made my way to get what i needed
... and my question is : was there a more "straightforward" way to do ?
Starting point :
- one matrix of 336 buttons
- one 'small' array of index values (folder buttons ones)
-
wanted to create the big "tracks index" array, without copy/pasting/typing numbers...
Here, the solution i found :
var indexRep = [0,6,12,33,60,61,63,84,103,118,133,142,149,152,155,164,191,209,230,244,272,291,297,304,312,317]
// creating the complete index values array
var TousIndex = []
for (var i = 0; i < 336; i++)
{
TousIndex.push(i)
}
console.log('tous les index : '+TousIndex)
// deleting all indexRep values found in the TousIndex array,
// to create a new array...
for (let i = 0; i < TousIndex.length; i++)
{
for(let j = 0; j < indexRep.length;j++)
{
if (indexRep[j] === TousIndex[i])
{
delete TousIndex[i]
var indexPistes = TousIndex.flat()
}
}
}
console.log('index pistes: '+indexPistes) // Tracks index array
console.log('index dossiers: '+indexRep) // Folders index array
So, again... i'm happy with this... but is there some more direct way to do ?...
Thank you