“Rahab came to them on the roof and said: "I know that the LORD has given you the land, that a dread of you has come upon us, and that all the inhabitants of the land are overcome with fear of you. For we have heard how the LORD dried up the waters of the Red Sea before you when you came out of Egypt, and how you dealt with Sihon and Og, the two kings of the Amorites beyond the Jordan, whom you doomed to destruction. At these reports, we are disheartened; everyone is discouraged because of you, since the LORD, your God, is God in heaven above and on earth below.” – Joshua 2:8-11
It’s not like the people of Jericho were massacred by unknown invaders. They knew who the Israelites were and the power of Yahweh. They also knew the Israelites had come to claim their inheritance. It was an opportunity for them to get rid of their pagan gods and worship Yahweh. Unfortunately they chose neither to accept Yahweh or forfeit the land to the Israelites. They could have requested to cohabit with the Israelites on the same land and worship the same God. I don’t think our Lord would have objected to that. After all, the Israelites were meant to be “a light to the nations”.
Furthermore, the people of Jericho were barbaric. Some of their religious practices were offering up young children as a sacrifice to their gods, fornicating with temple prostitutes etc.