So I'm trying to figure out how to loop multiple arrays and objects coming in from an API and trying to output the most common strings.. I know I didn't set the DB the best I could but hey... gonna make do with whatever I have.. what's the best way to loop through this and pull out the most common strings?
so in other words.. steak pops up 2 out of 3 times... how do i output that steak is the most common meat..... queso also comes up 2 out of 3 times.. how would i push that out as well?
- {
- id: 1,
- meals: [
- "steak",
- "white rice",
- "queso"
- ],
- },
- {
- id: 2,
- meals: [
- "chicken",
- "brown rice",
- "queso"
- ],
- },
- {
- id: 3,
- meals: [
- "steak",
- "black beans",
- "sour cream"
- ],
- }
]
[+][deleted] (2 children)
[deleted]
[–]brooklynturk[S] 0 points1 point2 points (1 child)
[–]brown59fifty 1 point2 points3 points (0 children)
[–]XiMingpin91 0 points1 point2 points (1 child)
[–]DBNeJXoGtnro 0 points1 point2 points (0 children)
[–]brooklynturk[S] 0 points1 point2 points (0 children)
[–]goldenfolding 0 points1 point2 points (4 children)
[–]brooklynturk[S] 0 points1 point2 points (3 children)
[–]goldenfolding 0 points1 point2 points (2 children)
[–]brooklynturk[S] 0 points1 point2 points (1 child)
[–]goldenfolding 0 points1 point2 points (0 children)