Here are some references to give context::
2 Samuel 5:18; 2 Samuel 5:22; 2 Samuel 23:13; 1 Chronicles 11:15; 1 Chronicles 14:9
Giants came to kill them in a valley. David must have felt nervous to say the least, he had to keep calm and steady himself in a tight situation like this one. But he did not fear evil, he may have drawn strength on the previous victories in the Valley of Elah where he killed Goliath. Each battle won gives us hope and confidence for the next.