Full-time web dev; JS lover since 2002; CSS fanatic. #CSSIsAwesome
I try to stay up with new web platform features. Web feature you don't understand? Tell me! I'll write an article!
He/him
Would it? Wouldn't you shorten by 4 chars to remove "",, or 3 if whitespace doesn't count, and only add 2 chars to go from [score] to [score-1]? Seems like it'd still be shorter by at least a character, or am I missing something?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It's a shorthand for returning one of three colors if the score is truthy. Otherwise it returns a fallback value.
that can be even more minified:
you could lose the first array item and use score - 1, but that would have more characters.
Would it? Wouldn't you shorten by 4 chars to remove
"",
, or 3 if whitespace doesn't count, and only add 2 chars to go from[score]
to[score-1]
? Seems like it'd still be shorter by at least a character, or am I missing something?