for(i = 1; i <= 20; i++){
let ingredient = meal.strIngredient + i
}
How can I put the value of variable i, in front of meal.strIngredient to pass in all strIngredient??
I need: meal.strIngredient1, meal.strIngredient2, meal.strIngredient3, meal.strIngredient4...
You could use:
meal['strIngredient' + i]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.