Electricity is amazing. It can flow through insulation, glass and tons of other materials that are typically thought to be insulators. While electricity has no issue with rain or snow falling on it, the moisture in those elements does cause problems for cords plugged into outlets.
Electrical regs says you shouldn’t use an extension cord outdoors when there is a risk of it being exposed to falling rain or snow. Electrical components in the cord and plug can be compromised by water which presents an increased danger of shock, electrocution, fire and explosion from moisture getting into electrical connections. If you want to use cords outdoors when there is no chance for precipitation then make sure they are rated as weatherproof, have a watertight connection between the cord and plug, or are specifically designed for outside use.