Js dom little bug

Js dom little bug
0.0 0

#1

what is happening i am comparing two colours and even if they are same the result is wrong help me find the bug please.


#2

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.


#3

thank you so much :smile: spend a lot of time finding this


#4

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)"

#5

yes, i got it now :roll_eyes: