Sodium and chloride form an ionic bond. Therefore the sodium atom loses one electron from its outer shell and the chlorine atom gains one electron. As this happens, the electron is transferred from the sodium atom to the chloride atom and so both atoms become ionic and have a full outer shell.