finally started with JS and I have a question.
Why doesn't this code work (I have two images with fir and sec Ids in HTML)
function swap() {
let x = document.getElementById("fir").src
let y = document.getElementById("sec").src
let z = x
x = y
y = z
}
But this one does
function swap() {
let x = document.getElementById("fir")
let y = document.getElementById("sec")
let z = x.src
x.src = y.src
y.src = z
}