Reputation: 389
is it possible to put a ternary operator inside a switch statement?
Something like this (which isn't working):
case "streetName" : entries[0][1] ?? entries[0][1] += `, ${value}` : value;
Upvotes: 0
Views: 1103
Reputation: 22247
Sure, use a single question mark and don't forget to assign the second part of the result to something:
case "streetName" : entries[0][1] ? entries[0][1] += `, ${value}` : entries[0][1] = value;
Upvotes: 1