Odd syntax: invoking a javascript function with two parenthesis pairs

Viewed 96

I am currently reading a book about AngularJS and I have a question regarding a javascript syntax that I don't understand.

var element = $compile('<button></button>')($rootScope);

How come the one can invoke a function with a two parenthesis pairs?

  1. ('<button></button>')
  2. ($rootScope)

Can anyone please advise about this js construct?

3 Answers
Related