This is a feature specific to Angular, although is similar to other language's constructs.
races are both names of arrays. Any name could've been used, and as long as the name was used consistently it'd work, but the designer chose to use those names. The pluralization isn't going to affect how things work, and other names could've been chosen. Using a plural version, though, although maybe not a convention, is often used for an array of items.
race are variable names chosen to iterate over each array respectively. The fact that they are singular versions of the arrays with which they're associated is only for human readability**
and yet no "s" was added to carParts
This is confusing me, as there is an s on the array
carParts, just like there is an
s on the
races array; the naming in this case is consistent. Please explain further, as I may be missing something.
** side note about naming
The similarity has always style-wise bothered me a bit, and I'd slightly prefer
allCarParts or something more distinctive than just a one-letter difference. This can get wordy, and has its own issues, and I don't think I've seen anyone kick up a fuss about it or suggest a good alternative.
Many use arguable worse versions, even, such as
races. A side-side note: I'm okay with that as long as the code within the loop is really short, and many I think agree with this, too.
And, although I've never seen any explicit style guidelines around
races, or against it for that matter, many examples use that type of naming for such loops