For this assignment, you are to generate a message to HTMl using Javascript. Your message will be in the form of a math equation. ex. 1 + 1 = 2

  1. In the body of your page create an empty HTML tag: ex. <p id="example"></p>
  2. use document.getElementById("example").innerHTML =
  3. Make sure that the ID on both lines matches EXACTLY and remember that IDs must be unique.
  4. Putting the equation together requires you to combine a string with an operation
  5. Write out your string. ex. "2 + 2 ="
  6. 'Add' your operation. ex. + (2+2)
  7. The complete line in Javascript should look like: document.getElementById("example").innerHTML = "2 + 2 = " + (2 + 2);

Your website should resemble the example below:




back to index