Practising with the DOM tree from the Console

thanks! but if I’m not on the console this code works:

var elements = document.getElementsByClassName('hot'); // Find hot items

if (elements.length > 2) {                            // If 3 or more are found

  var el = elements[2];              // Select the third one from the NodeList
  el.className = 'cool';             // Change the value of its class attribute

}

Is it because I’m in the console that I can’t select by class name and set an extra className?

Thanks!