Here's how it works:
* Sodium (Na) is a metal and has one valence electron (an electron in its outermost shell). It wants to lose this electron to achieve a stable electron configuration.
* Chlorine (Cl) is a nonmetal and has seven valence electrons. It wants to gain one electron to achieve a stable electron configuration.
When sodium and chlorine react, sodium loses its valence electron to chlorine. This results in:
* Sodium ion (Na+) - Sodium loses an electron, becoming positively charged.
* Chloride ion (Cl-) - Chlorine gains an electron, becoming negatively charged.
The opposite charges of the sodium and chloride ions attract each other, forming an ionic bond. This bond holds the ions together in a crystal lattice structure, forming sodium chloride (NaCl).