Alternating-Current Types:
You may get the idea that the electromagnet can be made far stronger if, instead of using a lantern battery for the current source, you plug the wires into the wall outlet. In hypothesis, this is true. In practice, you will blow the fuse or circuit breaker. Please do not try this. The electrical circuits in several buildings are not effectively protected, and a short circuit can generate a fire hazard. You can, also get a lethal shock from the 117-V utility mains.
Some electromagnets use 60-Hz ac. Such magnets "stick" to ferromagnetic objects. The Magnetic field polarity reverses every time the direction of the current reverses; there are 120 fluctuations or 60 complete north-to-south-to-north polarity changes, every second which is as shown in figure below. When a permanent magnet is brought close either "pole" of an ac electromagnet of the similar strength, there is no net force resultant from the ac electromagnetism since there is an equal quantity of attractive and repulsive force among the alternating magnetic field and the steady external field. Though, there is an attractive force among the core material and the nearby magnet generated independently of the alternating magnetic field resultant from the ac in the coil.
Figure: Polarity change in an ac electromagnet.