At first it was believed that it went back and forth between being a particle and wave. A few ignorant people think that today. Then it was decided that it was a particle and wave simultaneously but that you can only detect one or the other at one time. When people say this, they are acting as if light is somehow two things at once. It's not two things. It's one thing. They act like light at a fundamental level is similar to things in our daily lives, which it isn't. The problem derives from an early definition "knowing what something is". It was believed that knowing what something is meant visualizing it, having a picture of it in your mind. Whatever it is you're visualizing is something from your daily life. So what you're really saying is that whatever it is you're talking about is similar to that thing from you're daily life that you're visualizing. That rests on the assumption that there is something in your daily life that is similar to the thing you're talking about. That assumption is satisfactory when you're talking about the classical world. That assumption is not correct when you're talking about the quantum world.
People felt that to know what light is, they had to be able to visualize it. In other words, they had to be able to point to something in the macroscopic world, and say, "It is like that." In their attempt to do this, they ended up pointing to two things, waves and particles. In reality, light isn't like anything in the macroscopic world. People say light is both a particle and a wave. Light is neither a particle nor a wave. It's a subatomic entity in no way similar to anything in the macroscopic environment. Many people say, "light is a subatomic entity that under some conditions manifests itself mathematically as a particle and under other conditions manifests itself mathematically as a wave." This is true in a limited sense. When you say "manifests itself mathematically" you're referring to our model of light. Within our model, light is both a particle and a wave. When you say "light is a subatomic entity" you're referring to light as it really exists. You have to differentiate between our model, which was invented by humans, and actual reality. Whenever anyone talks about light being two things at once, they're talking about the model. In reality, light is not two things at once. It's one thing unlike anything in our daily lives or the macroscopic world. It's ironic that people who mistake our model for reality say that you can't visualize light as either a wave or a particle, and yet cling tenaciously to the right to visualize light as a particle and wave superimposed on top of each other like a photographic double exposure, or something similar. When people do this, they are trying to force the subatomic world to be similar to the macroscopic world. Even though I've used photons as an example here, this is of course true for all particles, quarks, leptons, bosons, etc. Richard Feynman said, "If you get rid of all these old-fashioned ideas, there is no need for an uncertainty principle!"
Does this insight shed any light on the electron going through the double slit experiment? No it doesn't. The electron is a subatomic entity that goes through the barrier with two slits and hits the screen behind. We put a transparent electron detector in front of each slit. One detector registers something and the other does not. We still have no idea why the one that registered something registered something, and the one that registered nothing registered nothing, instead of the other way around. Our only attempts to explain it are the models I have described. Who knows what's really true, or what models will exist in the future, but currently these models are all we have. We try to think up explanations for what we observe, so all we have are the observations, and our attempts at explanations.