Skip to content
Advertisement

Tag: multidimensional-array

Recursively filter an array of infinitely nested objects by mutliple matching conditions but only return parent that has an instance of both matches

I have the following array of objects; however this could be any unknown key/value and be infinitely nested, for now this is a testing sample: My current implementation is as follows: Basically I am adding to the “selected” array then using that to filter the data array by. I do want to ensure the key matches the “column” also however

JavaScript sort multiple array

Suppose I have this data Name Mark John 76 Jack 55 Dani 90 and for the grade Marks Grade 100-80 A 79 – 60 B 59 – 40 C suppose i declare the script as The program should assign the grade with the corresponding mark, how do I sort the grade since we know we cant change the index for

Generate and sort cartesian coordinates around (0,0) in all quadrants using Javascript’s nested array loops

I have an variable obj that has the element count that needs a cartesian coordinate. So I want to generate the following matrix. obj = 9, Square root of obj = 3, 3×3 matrix (-1,1) (0,1) (1,1) (-1,0) (0,0) (1,0) (-1,-1) (0,-1) (1,-1) obj = 25, Square root of obj = 5, 5×5 matrix (-2,2) (-1,2) (0,2) (1,2) (2,2) (-2,1)

Javascript filtering a nested array to exclude objects that don’t include one of several elements

I have a fairly simple nested array of objects. Each object is composed of 5 (string) values, e.g. [“0,0”, “0,0”, “0,0”, “0,0”, “0,1”]. There are no variables attached, hence using arrays inside an array. Each object represents a puzzle solve permutation being tested by other parts my code. The main data set is composed of 150k permutations. I want to

Advertisement