Other way to do it is using query selector querySelector to select image class and set its src attribute to the new path.
var image1 = document.querySelectorAll("img")[0]; image1.setAttribute("src","/images/image1.png")