Skip to content
Advertisement

Tag: arrays

Divide array to group indexes

I have a problem with the following logic in Javascript. I have the following array, that have dynamic number of indexes, in this example I write one array with 2 indexes. [[S,Blue],[M,Red],[L,Yellow] I want to have this structure: { 0: [S,M,L], 1: [Blue,Red,Yellow] } The numbers are the indexes of first group of array, what can I do? I tried

Filtering boolean and returning parent title

I need to chains.fitler(x=>x.inStock) bool statement then return the specific key, i also want to add conditions to return all if none are true. EX: key1, key5 | inStock:true return key1,key5 Answer Not 100% sure how you want the input and output to be but you should get a bit closer with this implementation:

Advertisement