how to check if a color is valid in javascript

Solutions on MaxInterview for how to check if a color is valid in javascript by the best coders in the world

showing results for - "how to check if a color is valid in javascript"
Jona
19 May 2017
1function isValidColor(strColor) {
2  var s = new Option().style;
3  s.color = strColor;
4
5  // return 'false' if color wasn't assigned
6  return s.color == strColor.toLowerCase();
7}
similar questions