function setImg(dieImg) { var value = Math.floor( 1 + Math.random()*6); dieImg.setAttribute( "scr" , "die" + value + dieImg.setAttribute( "alt" , "die Image with " + value + "spot(s)"); }
First of all, we need to know about tag.
It has several attributes for showing and manipulating image.
https://www.w3schools.com/tags/tag_img.asp
src ( you miswritten) attribute is for indicating the source of image so that it should be url of the source.
alt attribute is for alternative string if the given image with url doesn't exist.
For example,
<img src="https://example.com/image_path.png" alt="Die with....">
setAttribute() function is to add these attribute programmatically.
So I think you miswritten the code
function setImg(dieImg) { var value = Math.floor( 1 + Math.random()*6); dieImg.setAttribute( "scr" , "https://example.com/image_path.png" );
dieImg.setAttribute( "alt" , "die Image with " + value + "spot(s)"); }
Hope it will be helpful