This question already has an answer here:
What does the exclamation mark do before the function?
The 'executing' parens at the end can't be done legally after a function expression. A typical (more sensical, IMO) way of writing this is with more parentheses:
By prepending the
! before the function expression, the JS interpreter reads the function and then runs it. This is because of the precedence of the
! operator vs. calling a function with the final
Look at this answer
tl;dr it defines a function to print out 'hi' and immediately calls it.