Skip to content Skip to sidebar Skip to footer

Javascript Syntax []() And ()()

I'm having trouble understanding these javascript syntaxes. In the block of code below, on the second line. The square bracket is quickly followed by a round bracket or parentheses

Solution 1:

Answers are in the comment to the question. Had to copy them out again, so i can mark the question as answered and close it.

"Not sure what's going on with the first one. For the second one, connect() is a function that returns a function so the second () is to immediately call that returned function." – Ouroborus

"The first one is a dynamic object literal property that is also an object method. I find this not readable at all. I would re-write that one. – Davin Tryon"

and also a link to Computed property names to make it clearer from – Denys Séguret

Thanks Guys.

Post a Comment for "Javascript Syntax []() And ()()"