Dear Student ,
The most common reason to add salt (sodium chloride) to water when hard boiling an egg is to the increase the temperature of the water for better cooking. Evidence also suggests that salted water prevents an egg from cracking.
Also , the boiling point of water is 100 C or 212 F. Adding a water-soluble material such as salt increases the boiling point. When cooking savory foods, salt is generally used.
Regards