[英]Helper Functions not working in Javascript
I want to use 2 helper functions for a function.我想为 function 使用 2 个辅助函数。 Output is not showing any error but the output is showing the function syntax instead of return value
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 is a function . document.write 是 function 。 Call it as such.
就这样称呼吧。
document.write(cuboidsurfaceArea(10,5,20));
If you want the value returned somewhere, assign it to a variable or return it from a function.如果您希望在某处返回值,请将其分配给变量或从 function 返回。 Append it to a DOM element.
Append 它是一个 DOM 元素。 You need to be specific about the use case if you want additional help on what to do with it.
如果您需要有关如何处理它的其他帮助,您需要具体说明用例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.