Not showing correct perimeter

javascript

#1

Why isn't this showing the correct perimeter

var u = prompt("Please enter the type of unit you are using for your rectangle");
var h = prompt("Please type in the length of the height for your rectangle");
var b = prompt("Please type in the length of the base for your rectangle");

var calc = function (x, y, z) {

console.log("The perimeter of your rectangle is " + x, y * 2 + z);
console.log("The area of your rectangle is " + x * y + z);
};
calc(h, b, u);


#2

Like i said last time, if you want to change the strings to a number type you need to change it to an integer. And you do that using parseInt().

So change this:

To this:

var u = parseInt(prompt("Please enter the type of unit you are using for your rectangle"));
var h = parseInt(prompt("Please type in the length of the height for your rectangle"));
var b = parseInt(prompt("Please type in the length of the base for your rectangle"));

#3

Number(); will also work