What Myzozoa said.
In future, if you have any questions about game mechanics, I suggest checking the
Pokémon Showdown Pokedex.
If a question isn't answered by that, Bulbapedia is generally pretty detailed when describing mechanics, and failing that it's worth checking out the
SM and
USUM battle mechanics research threads.
If you still can't find the answer to your question after looking in those places, drop a question in a Simple Questions/Simple Answers thread in an appropriate forum (I think
this one would probably be the one but I'm not 100% sure) or ask for help on Pokemon Showdown.