Atoms and atomic ions with sequences of completely filled electron shells exhibit enhanced stability. The prime examples are the noble gases, He, Ne, Ar, Kr, Xe, and Rn, containing one of the "magic numbers" of electrons: 2, 10, 18, 36, 54, and 86, respectively. These gases are colorless, odorless, and chemically inert (although a few compounds of Kr, Xe, and Rn have been synthesized in recent years).
Elements in the extreme right and left portions of the periodic table, whose atoms differ from a closed-shell structure by one or two excess or missing electrons, tend to form stable anions or cations by a gain or loss of one or two electrons. To cite two well-known examples:
both have the closed-shell structure of neon.
The graphic shows the relevant fragments of the periodic table as well as a stylized representation of the electron shell structure. You can select the noble gas configuration and the related ion with either positive or negative charges one or two.