Practising with the DOM tree from the Console

No, it’s working in your code above because you’re setting the className of a specific element, namely document.getElementsByClassName('hot')[2], whereas in your OP you’re setting the className of an HTMLCollection. Have a look here for reference. :-)