Note that the prompt
function always
returns a string, even if the user entered a
number. For example, consider the following script:
let num1 = prompt('Enter the first number');
let num2 = prompt('Enter the second number');
alert(num1 + num2); // concatenates numbers like strings
Modify the above code so that numbers are summed not like strings.
Use the prompt
function to ask
the user for the side of a square.
Display the area of the given square.
Use the two functions prompt
to ask the user for the sides of a
rectangle. Display the perimeter of
the given rectangle.