Therefore:
1 - this.mutation = this.get // returns this.get
2 - this.query = <return value of this.mutation = this.get, which is this.get>
3 - this.patch = <return value of this.query = this.mutation = this.get, which is this.get>
n - and so on...
Essentially, it's setting 6 different properties all to the same value.
---
EDIT: Here's the same concept, but in a different context...
function fibonacci(num, memo = {}) {
if (num <= 1) return 1;
if (memo[num]) return memo[num];
return memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo);
}On the return line, the right-to-left property of "=" forces the extreme right to be processed first. It returns the recursive call.
Then, the return value of this recursive call gets saved to "memo[num]".
Finally, the return value of "memo[num] = fibonacci(...) + fibonacci(...)", which is still the same return value from the recursive call, gets saved to the function return.
Like if you wanted to return a empty hash {} for:
GET /
DELETE /
PUT /
PATCH /
POST /
I guess just being lazy.It looks impressive in software interviews, but I don't really see the use in it for production code. Not every JS dev immediately knows what's going on with this syntax.