It goes back to Psalm 2. Yahweh laughed at his enemies. In Zechariah 9, after ravaging the enemies of Israel in His North to South destruction tour, Yahweh enters Jerusalem to great shouts:
Rejoice greatly, O daughter of Zion!
Shout aloud, O daughter of Jerusalem!
As Joyce Baldwin observes: “His arrival is to be accompanied with wild joy.”