Assignment 30: A Possible Answer


<SCRIPT LANGUAGE="javascript">

var number = prompt("Put in a number between 2 and 10","Write it here")
var square = number * number

document.write("Your number was " +number+ ". Its square is " +square+ ".")



Gives you this:

     The script calls for a number and assigns it the variable name "number." Then that number is multiplied by itself and assigned the variable name "square." Then it's a basic document.write statement to get it to the page.


Did You Get It?


Back to the Index Page