It is because backgroundColor is an rgb value, not a string. For example add
alert(document.body.style.backgroundColor)
right after you set it and you'll see it is not the string you just set it to. It does work, you just can't test for the background color that way.
If you want to test for the background color's hex value there is some code that looks like it will work,
javascript - How to get hex color value rather than RGB value? - Stack Overflow[
^]