DEV Community

Discussion on: Why this regex it's not working properly? [solved]

Collapse
 
blindfish3 profile image
Ben Calder • Edited

Oh - and one suggestion in terms of naming - I wouldn't use food in your iterator or array name:

for (const food of foodList) {
}
Enter fullscreen mode Exit fullscreen mode

It might seem pedantic; but at this point you're testing whether they are food; so I'd use generic terms item and itemList.