[英]Helper Functions not working in Javascript
我想为 function 使用 2 个辅助函数。 Output 未显示任何错误,但 output 显示 function 语法而不是返回值
function cuboidlwsidesSurfaceArea(length,width,height) {
return 2*length*width
}
function cuboidwhsidesSurfaceArea(length,width,height) {
return cuboidlwsidesSurfaceArea(length,width,height) + 2*width*height
}
function cuboidsurfaceArea(length,width,height) {
return cuboidwhsidesSurfaceArea(length,width,height) +2*length*height
}
document.write = cuboidsurfaceArea(10,5,20)
</script>
document.write = cuboidsurfaceArea(10,5,20)
document.write 是 function 。 就这样称呼吧。
document.write(cuboidsurfaceArea(10,5,20));
如果您希望在某处返回值,请将其分配给变量或从 function 返回。 Append 它是一个 DOM 元素。 如果您需要有关如何处理它的其他帮助,您需要具体说明用例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.