I was wondering how can you combine two variables (or more) that have the same string values, but different numbers.
For example, if you're combining a list of ingredients that are present in two different recipes. For a shopping list, like:
let ingredient1 = 1 + " apple";
let ingredient2 = 2 + " apple";
//combining ingredient1 and ingredient 2 would produce something like totalIngredients = 3 apples;
I can kind of figure out the pluralization, but I can't figure out how I can combine those two strings and for it to only increase the number if they're matching.