Experimenting with Ionic2
and Typescript
has been my recent focus.
I have an object that contains various meals, calorie counts, and meal types (such as vegan).
This is how the object looks:
[
{
"id":14093,
"name":"Proteinshake mit Wasser – ESN Designer Whey Protein",
"description":"",
"thumbnail":null,
"image":null,
"calories":[
"200"
],
"type":[
"snack"
],
"nutrition":[
"pescetarier",
"standart",
"vegetarisch"
]
},
{
"id":14088,
"name":"Omelette mit Garnelen",
"description":"",
"thumbnail":null,
"image":null,
"calories":[
"400"
],
"type":[
"fruehstueck",
"gericht"
],
"nutrition":[
"pescetarier",
"standart",
"vegetarisch"
]
}
]
Now I am looking to create a random meal plan.
I aim to include 3 random meals with 400 calories each and 2 Snacks with 200 calories each.
Is there a way to select meals randomly based on their calorie value?