简体   繁体   English

函数 - 显示与执行 console.log

[英]Functions - Display vs. Execution console.log

I have a feeling this is really simple but I am having trouble finding any guidance on how to create a "console.log" statement that simply displays the contents of the function instead of executing the function below:我有一种感觉,这真的很简单,但我无法找到有关如何创建“console.log”语句的任何指导,该语句仅显示函数的内容而不是执行以下函数:

here is the challenge:这是挑战:

Create a console log that displays the contents of the function rather than executing it.创建一个控制台日志,显示函数的内容而不是执行它。 For example, your result should be function add20 (num){ return num + 20 }.例如,您的结果应该是 function add20 (num){ return num + 20 }。

Here is the code:这是代码:

function add20 (num){
  return num + 20
}

// CREATE YOUR CONSOLE.LOG BELOW 

How can I write a console.log statement to display the contents of the function?如何编写 console.log 语句来显示函数的内容?

Just log the function without calling it?只记录函数而不调用它?

 function add20 (num){ return num + 20 } console.log(add20);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM