简体   繁体   English

VSCODE 未显示 javascript 功能 console.logs

[英]VSCODE not showing javascript fuction console.logs

I've just started learning JavaScript and I'm following some online tutorials, this is what the tutorial has on vscode:我刚刚开始学习 JavaScript,并且正在学习一些在线教程,这就是教程在 vscode 上的内容:

function countdown() {
    console.log(5)
    console.log(4)
    console.log(3)
    console.log(2)
    console.log(1)
}

console.log(countdown)

and it works fine, but on mine it will not work, this is what it returns:它工作正常,但在我的它不会工作,这就是它返回的内容:

[Running] node "c:\Users\jmont\OneDrive\dev_prog\javascript\index.js" [Function: countdown] 【运行】节点“c:\Users\jmont\OneDrive\dev_prog\javascript\index.js”【功能:倒计时】

[Done] exited with code=0 in 0.152 seconds [完成] 在 0.152 秒内以 code=0 退出

I have node.js installed, and I have code runner extension as well我安装了 node.js,我也有代码运行器扩展

Call the function:调用函数:

console.log(countdown())

Right now you are only passing a reference to the function.现在您只传递对函数的引用。

You need to call the function by adding the parentheses in order for it to print what you want it to.您需要通过添加括号来调用该函数,以便它打印您想要的内容。

console.log(countdown())

this will give the desired output这将给出所需的输出

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

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