Why are electrical cords often covered with rubber?

Electrical cords are often covered with rubber or another insulating material to protect the wires inside from coming into contact with any conductive material or surfaces that could cause a short circuit or electrical shock. The rubber also provides a barrier between the electrical wires and the outside environment, helping to prevent damage from moisture, chemicals, and physical abrasion. Additionally, the rubber covering helps to make the electrical cord more flexible and durable, allowing it to withstand frequent bending and stretching without breaking or damaging the wires inside.