You learned that elements other than the noble gases are
energetically unstable and therefore they react with other
elements to be stable.
That atoms of elements, apart from the noble gases, try to
attain a stable state by
–either
losing electrons, or
–gaining
electrons, or
–sharing
electrons.
so that they have a completely filled valence (outer) shell
just like the noble gases.