When David offered to fight the dreaded giant of the Philistines, he showed not a trace of hesitancy, doubt, or fear, although some demeaned him and scoffed at him. See I Sam. 17:4-25, 28-50. He was certainly not to be compared with Goliath physically. But David knew something the warriors around him did not know. He knew that God was good and all-powerful. He also knew that God would help him overcome the giant, no matter how big and frightening he might appear to be.
How was David so sure of this? He even refused the armor the king offered him! The Biblical account tells us that David told the king how, when he was tending his father's sheep, a lion and a bear attacked not only his flock but his own person. However, because of his unwavering faith in God, he "slew both the lion and the bear."
He had positive proof of God's presence, power, and love. Why should he fear a new encounter now? He told the king that God would deliver him from the Philistine just as He had saved him from the lion and the bear. And, of course, the giant was felled with one small stone from David's sling.