1 Samuel 17:35
And I went out after him, and smote him, and delivered it out of his mouth: and when he arose against me, I caught him by his beard, and smote him, and slew him. And I went out after him, and smote him, and delivered it out of his mouth: and when he arose against me, I caught him by his beard, and smote him, and slew him.
David was recounting his own work guarding his father's sheep and flock when a lion or a bear seized a lamb or sheep, and he went out after the predator, struck it, and delivered the prey alive out of its mouth, and when the beast rose against him he caught it by its beard and struck it and killed it. He did this at personal risk to his own life, protecting his charge with only his sling and shepherd's staff according to the custom of his time. That fight took place in the lonely hills and wild ravines where lions from the thickets by the Jordan and bears from their lairs among the hills came fierce with hunger to attack the flocks. He had already risked his life in this way to pursue a lion that carried off a sheep, rescue the sheep, and kill the lion when it turned to attack him.
God used this watchcare over the flock to teach David lessons of trust and to fit the son of Jesse to become the guide of His chosen people. It gave him an appreciation of the care the Great Shepherd has for the sheep of His pasture. By it his heart was proved and there were developed in him courage and fortitude and faith.
David credited God with delivering him from these beasts, and that deliverance gave him confidence that the Lord who had delivered him from the lion and the bear would also deliver him from Goliath. This experience helps explain the courage he later showed against Goliath. He stands as a humble example of trusting in God rather than human weapons or prepared arguments, going out relying on God to give the truth the victory.