search

Home  >  Q&A  >  body text

Why is it necessary to declare a closure like this?

var add = ()() Why do we need two brackets when declaring a variable?

hopolhopol2382 days ago1059

reply all(1)I'll reply

  • MrSwan

    MrSwan2018-05-22 12:46:32

    var add = (function(){})(); will directly execute the function and get the return result

    reply
    1
  • Cancelreply