本文介绍了如何使我的函数在javascript中使用来自用户的输入(带提示)计算矩形区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我必须创建一个函数来计算矩形的面积,周长和体积,提示用户输入高度,宽度和长度,并使用document.writeln()写出输入和输出。 我尝试过: var length = prompt(输入一个整数对于矩形的长度。); var width = prompt(输入矩形宽度的整数。); 功能区(长度,宽度){ 返回长度*宽度; } console.log(矩形区域为+区域; 解决方案 I have to create a function to calculate the area, perimeter, and volume of a rectangle, prompt user to enter height, width, and length, and write out inputs and outputs using document.writeln().What I have tried:var length = prompt("Enter a whole number for the length of your rectangle.");var width = prompt ("Enter a whole number for the width of your rectangle.");function area (length, width) {return length * width;}console.log(The area of your rectangle is " + area); 解决方案 这篇关于如何使我的函数在javascript中使用来自用户的输入(带提示)计算矩形区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 21:30