Not the OP, but from my experience teaching web dev, one possible reason is nerves. I’ve seen some of the smartest students make that mistake on an assessment simply because they were under pressure. A simple conversation afterwards shows that they do understand the difference (as expected). In the moment though, sometimes you just have a brain fart.