In an ionic compound, the metal atom loses one or more electrons to the nonmetal atom. This creates positively charged metal ions and negatively charged nonmetal ions. The ions are then attracted to each other and form a crystal lattice.
In the case of sodium and sulfur, sodium will lose one electron to sulfur. This will create a sodium ion (Na+) and a sulfide ion (S2-). The sodium and sulfide ions will then be attracted to each other and form a crystal lattice.
The compound formed by sodium and sulfur is called sodium sulfide. Sodium sulfide is an ionic compound that is used in a variety of applications, such as the production of glass, paper, and soap.