Homework 2

  1. Write a function called square() that accepts a number as an argument and returns the square of that number. Put this in an HTML file that has a text field where I can enter a number and a button that, when clicked, shows an alert with the result of square().
  2. Go back and look at our temperature conversion example code. Create similar code that asks someone to enter their weight in pounds and converts it to kilograms. Print the output into the document using the getElementById method demonstrated in the examples.