Why am I getting a TypeError when adding console.log to my code

I have the following code that works fine:

const user = {
    hello() {
        console.log("Hi:", this)
    }
}

const commonJs = (user) => function() {
    (0, user["hello"])()
}

commonJs(user)()

However, when I add console.log("Running"), I get the error Uncaught TypeError: console.log(...) is not a function:

const user = {
    hello() {
        console.log("Hi:", this)
    }
}

const commonJs = (user) => function() {
    console.log("Running")
    (0, user["hello"])()
}

commonJs(user)()

I don’t understand why this happens since I thought adding a simple console.log would not cause any issues.

I noticed that when I add a semicolon (;) after console.log("Running"), the error disappears:

const user = {
    hello() {
        console.log("Hi:", this)
    }
}

const commonJs = (user) => function() {
    console.log("Running");
    (0, user["hello"])()
}

commonJs(user)()

But I don’t understand why the error occurs without the semicolon.