I was reading about covalent bonding and got to know that in this type of bonding, the atoms of elements "share" electrons with each other to have an octet or duplet. But, I also have been taught that electrons keep on revolving around the nucleus of the atom, much like the planets around the sun. But, if this is true, how are the able to easily share electrons if these electrons keep on moving around their respective nuclei? I hope I have made myself clear. If not, then please tell in the comments.
electrons keep on revolving around the nucleus of the atom, much like the planets around the sun.
Electrons are quantum particles. Trajectories are not applicable for them. One have to use quantum wave equation to explain "movement" (note the quotes, you cant say anything about electron movement, you can only determine the probability of electron presence in some place) of electron. Planetary (Bohr) model of the atom can help to describe some effects for isolated atoms using Newtonian physics' equations with some amendments (Bohr quantum rules), but it does not describe bonding.
So for bonding you can use valence bond theory (which exactly the case with sharing electrons you described) or some more complex theories (molecular orbital (MO) theory, as widely used example) which consider quantum wave equations for describing electrons. But you surely can't mix in Bohr atom model in this case, because it is too simple to describe bonding.
Hope my explanation helps.