Elements by tagname not working

what am i doing wrong here?



var x = 5, y = 2;
  x += y;

  document.getElementsByTagName('div').innerHTML = x;


“The Element.getElementsByTagName() method returns a live HTMLCollection of elements with the given tag name.”

The live collection it returns is not a single element but rather like an array:

After reading the above documentation how do you think you would access the <div>?

1 Like

Ya, Makes sense now.This is just my second day of understanding JS in depth.Thank you!