Ammonia does kill mold on nonporous surfaces like glass. However, it will not kill mold that has accumulated on surfaces that are porous and absorb liquids. Wood and drywall are two common materials that may contain mold and on which ammonia is not effective.
To treat mold growth, mix equal parts of water and ammonia. Pour the mixture into a spray bottle and spray it on the mold. Let the mixture sit undisturbed for a few hours and then wipe the area down with a wet rag.
Ammonia is toxic and becomes even more toxic if mixed with bleach. It is safer to use borax to kill mold, because it is does not emit fumes and is not toxic unless swallowed.