Choosing the Right One
When to use each.
Choosing a Scope Function
With five scope functions available, picking the right one comes down to two questions:
- How is the object referenced:
thisorit? - What is returned: the lambda result or the object?
The Decision Table
Here is the full picture:
letusesit, returns lambda result.runusesthis, returns lambda result.withusesthis(arg), returns lambda result.applyusesthis, returns object.alsousesit, returns object.
All lessons in this course
- let and run
- apply and also
- with
- Choosing the Right One