what is happening i am comparing two colours and even if they are same the result is wrong help me find the bug please.
selectedColor is something like
rgb(255, 0, 0) while
requiredColor is in the format
rgb(255,0,0). Note that one has whitespace after the commas, while the other has not.
thank you so much spend a lot of time finding this
Adding to what @BenGitter states, you can see for yourself by adding the following before the if statement:
console.log(selectedColor); // displays "rgb(255, 0, 0)" console.log(requiredColor); // displays "rgb(0,0,255)"
yes, i got it now