Here's why they bond:
* Sodium is a metal with one valence electron. It wants to lose this electron to achieve a stable electron configuration.
* Chlorine is a nonmetal with 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, and chlorine gains it. This results in:
* A positively charged sodium ion (Na+)
* A negatively charged chloride ion (Cl-)
These oppositely charged ions are attracted to each other through an ionic bond, forming the compound sodium chloride.