Here's why:
* Sodium is a highly reactive metal in Group 1 of the periodic table.
* Fluorine is a highly reactive nonmetal in Group 17 of the periodic table.
* When they react, sodium loses one electron to become a positively charged ion (Na+) and fluorine gains one electron to become a negatively charged ion (F-).
* These oppositely charged ions attract each other, forming an ionic compound called sodium fluoride (NaF).