The correct answer is the octet rule.
Octet rule states that atoms tend to bond in order to have 8 electrons in their outer most electron orbit achieve stable configurations of noble gases.
When atoms form covalent bonds, they achieve the goal of having 8 electrons by sharing the electrons.
In ionic bond, atom either gain or lose an electron and form ions that have the stable configuration of 8 valence electrons.
Not all atoms follow the octet rule and there are many exceptions and variations.