Step-by-step explanation:
Sodium being a metal has 1 extra electron whereas chlorine being a non-metal is electron deficient. As a result, in order to complete their octet sodium will transfer its one electron to chlorine.
As a result, sodium becomes positively charged and chlorine will become negatively charged. Thus, there will be formation of an ionic bond between sodium and chlorine.
This opposite charge on both these atoms will cause an electrostatic repulsion between the two.
Thus, we can conclude that the difference in charge between the two atoms creates a(n) electrostatic attraction that bonds them together.