I'm testing and trying out some new things I recently learn about functions and I come across something like this
let testFunction = function() { console.log('Hello')}();
let testFunction = function() { console.log('Hello')}();
now this works and shows the hello on the console. However I decide to take away the
()
()
at the end and I no longer see the hello on the console. Then I try this to see if the hello would show up but instead I get two things Hello and undefined. I have an idea of whats going on and I think the
()
()
in the first statement automatically invoke without being called i think but i'm not sure and I can anybody help me understand why when I console log