Home > Mobile >  VSCODE not showing javascript fuction console.logs
VSCODE not showing javascript fuction console.logs

Time:06-23

I've just started learning JavaScript and I'm following some online tutorials, this is what the tutorial has on 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]

[Done] exited with code=0 in 0.152 seconds

I have node.js installed, and I have code runner extension as well

CodePudding user response:

Call the function:

console.log(countdown())

Right now you are only passing a reference to the function.

CodePudding user response:

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

  • Related