How to find the perimeter of a rectangle in JavaScript: First create an HTML sample file; then add a script tag to the body; and finally use prompt in js to get the width and height of the rectangle to calculate the perimeter.
The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer
How to find the perimeter of a rectangle using JavaScript?
Use prompt in js to get the width and height of the rectangle to calculate the perimeter and area
prompt("msg","defaultText")//The first parameter is the slenderness Prompt information is required in the box. The second parameter is the default value of the text that needs to be output in the box. You can manually enter the value that needs to be entered
Recommended study: "javascript advanced tutorial"
The above is the detailed content of How to find the perimeter of a rectangle in JavaScript. For more information, please follow other related articles on the PHP Chinese website!