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.
Re:REST and GraphQL really aren't that different
by pighive on Wednesday January 30, 2019 @02:47PM
(#19038645)
Thanks for taking time to put an example. I am familiar with the assignment rule, but this is a refresher. My question was more on why it was one function being used for all others.
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 = {}) {
}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.