Console log understanding

let output = "Hello World";
let counter = 0;
welcome(output);
welcome(output);
welcome(output);

function welcome(para) {
    counter++;
    let temp = counter + " times run";
    console.log(para);
    console.log(temp);
}

In the above small JS function why is this line console.log(para); so important, and w/o this line console.log(temp); is also not publishing anything.

Hi @codeispoetry, could you post the code where temp wouldn’t get logged? There must be another error, the previous log shouldn’t have anything to do with it.

BTW you can actually pass multiple arguments, like console.log(para, temp).

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.