When Israel had finished killing all the inhabitants of Ai in the open wilderness where they pursued them, and all of them to the very last had fallen by the edge of the sword, all Israel returned to Ai and struck it down with the edge of the sword.
We have here an account of the improvement which the Israelites made of their victory over Ai. 1. They put all to the sword, not only in the field, but in the city, man, woman, and child, none of them remained, Jos 8:24.
Commenting on Joshua 8:23-29
And it came to pass, when Israel had made an end of slaying all the inhabitants of Ai,.... That came out against them: in the field, in the wilderness wherein they chased them; both in the arable lands that were sown with corn, and now clothed with it, the wheat especially, not being gathered in, as not yet ripe, and in the pasture ground, designed...
all the Israelites returned unto Ai, and smote it with the edge of the sword--the women, children, and old persons left behind, amounting, in all, to twelve thousand people [Jos 8:25].