Forecast icons question

In HTML/CSS/Javascript, how do you go about matching the forecast conditions from the API with a matching icon? I’m able to retrieve the data from the API, I just don’t know how to get the matching icon. I don’t necessarily need code examples, just a general idea. Thanks in advance for any help.

Same or similar questions here… what’s the URL and file type for the icons?

Possible Icon Values:
clear-day
clear-night
cloudy
foggy
partly-cloudy-day
partly-cloudy-night
possibly-rainy-day
possibly-rainy-night
possibly-sleet-day
possibly-sleet-night
possibly-snow-day
possibly-snow-night
possibly-thunderstorm-day
possibly-thunderstorm-night
rainy
sleet
snow
thunderstorm