Javascript setting image source in api call

Ive Read a couple Examples on how to set img src from js, but when i try to implement them it doesnt work. the ways I have tried are but neither of them seem to work.

document.getElementById("currentTemp").innerHTML = "Current Temp: " + currentData.list[1].main.temp + "°F";

const currentImg = document.getElementById("currentImg");

currentImg.src = "https://openweathermap.org/" +currentData.list[1].weather[0].icon + ".png";

//document.getElementById("currentImg").src =  currentData.list[1].weather[0].icon;