If you used a smiley to indicate that you weren't 100% serious and you proceed the sentence that says you weren't 100% serious with a smiley, that means you weren't 100% serious about not being 100% serious and we get stuck in a loop of endless recursion ...
Yeah, good catch!
After a little research, it seems that if you try the subtraction operator on two strings in JS, it will first cast them to numbers and then perform the arithmetic. This still had the effect I wanted in my script, as this:
sidebar.className = sidebar.className - " fixed";
NaN which was then assigned to the sidebar as a class name, which worked, the but in spite of my code, rather than because of it.
It would have been better to write this:
sidebar.className = "";
I didn't know about this. I'll check it out. Thanks.