Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Wing Sun Cheung4,933 Points
Instead of using a closure, why not use a computed property?
From refactoring our code, howcome Pasan choose to initialize the property using a closure instead of a computed property? Since the closure is executed DURING the object initializing, and we need to add in the
lazy keyword, isn't this a roundabout why to achieve what we want to achieve? Why not just have a computed property?
Is it because since computed properties are executed every time you refer to it and closure are executed only once(?), for that reason, we use closures because it would be more efficient to choose the closure path.
David Lin35,864 Points
Here's a SO post that might help: Difference between computed property and property set with closure