Jump to content
Larry Ullman's Book Forums

TFotH

Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About TFotH

  • Rank
    Newbie
  1. Hi, Trying to learn JavaScript. I was playing with the code and I'm a little confused about something seemingly simple. In the code below (from chap 5 random.js), when I comment out the line, var output = document.getElementById('output');, and save the file. When I refresh the browser window it still generates a random number. If I type "output" in the console I get <span id="output">. If I type "output.textContent" I get the random number. It seems as if this variable is not even needed. What is the reason for this? function showNumbers() { 'use strict'; // Variable to stor
×
×
  • Create New...