I am using quite a few ternary operators instead of select case statements.
These work fine to my best knowledge but I get now a lot inspection warnings from WebStorm telling me that comma expressions could be overly clever and may lead to subtle bugs. There are also warnings about the value assigned never being used.
Is this the correct use of a ternary operator or should I use something different to be on the safe side?
u_avg < siteColorArray[0] ?
(fillColor = '#FF6600', strokeColor = '#FF8C00') :
u_avg < siteColorArray[1] ?
(fillColor = '#FF8C00', strokeColor = '#FFB300') :
u_avg < siteColorArray[2] ?
(fillColor = '#FFB300', strokeColor = '#FFD900') :
u_avg < siteColorArray[3] ?
(fillColor = '#FFD900', strokeColor = '#FFFF00') :
u_avg < siteColorArray[4] ?
(fillColor = '#FFFF00', strokeColor = '#CDE30F') :
u_avg < siteColorArray[5] ?
(fillColor = '#CDE30F', strokeColor = '#9CC71E') :
u_avg < siteColorArray[6] ?
(fillColor = '#9CC71E', strokeColor = '#6AAA2D') :
u_avg < siteColorArray[7] ?
(fillColor = '#6AAA2D', strokeColor = '#388E3C') :
u_avg >= siteColorArray[7] ?
(fillColor = '#388E3C', strokeColor = '#2E7D32') :
null;
WebStorm doesn't like it a lot...
Edit: Just to clear things up. This works well on Chrome 54+ but I am concerned whether other and older platforms may not like this.