Dropdown code country state city

Please make me understand this JS code. I know whats going on, but syntactically i didn’t get.