Here's a breakdown:
* Sodium (Na) has one valence electron in its outermost shell. It readily loses this electron to achieve a stable, filled outer shell. This makes it a positively charged ion (Na+).
* Chlorine (Cl) has seven valence electrons. It readily gains one electron to achieve a stable, filled outer shell. This makes it a negatively charged ion (Cl-).
The opposite charges of Na+ and Cl- attract each other strongly, forming an ionic bond. This attraction is electrostatic in nature, meaning it's a force of attraction between opposite charges.
The resulting structure is a crystal lattice where each Na+ ion is surrounded by six Cl- ions and vice versa. This structure is a result of the strong electrostatic attraction between the ions, which holds the entire compound together.