How does An Electromagnet Work?

An electromagnet is a piece of metal that is temporarily magnetized by an electromagnetic field. Wire is wrapped around the metal. When electricity flows through, it will magnetize the metal.