Backend or usual programming without context is also useless. Is foo even mutable? Is it the same type? How does type conversion work here?
CSS and usual programming are identical. If you don't give yourself the time to learn the fundamentals, you'll always run into tedious problems.