Again, I'm a JS newbie trying to get by and have to write a function that does the followings:
function isWebColor(v)
where v can be anything. return true if it is a
series of 6 hexadecimal digits (may or may not have #
in front of them). otherwise return false.
So, if v were 123456, then it would be true
if v were 12345, it wouldn't, because there are only 5
digits. Also, since they are hex digits, a-e are
allowed as well, and it doesn't matter if they're
upper case or lower.
v as "#3366AA" would return true.
v as "3366LL" would return false.
Could anyone start me in the right direction to create such a function? Any help would be appreciated.
Thank you.
Cathy
function isWebColor(v)
where v can be anything. return true if it is a
series of 6 hexadecimal digits (may or may not have #
in front of them). otherwise return false.
So, if v were 123456, then it would be true
if v were 12345, it wouldn't, because there are only 5
digits. Also, since they are hex digits, a-e are
allowed as well, and it doesn't matter if they're
upper case or lower.
v as "#3366AA" would return true.
v as "3366LL" would return false.
Could anyone start me in the right direction to create such a function? Any help would be appreciated.
Thank you.
Cathy