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
jsdevtom
16,963 PointsUpdating and/or setting values of object properties stored in variables
This is my freeCodeCamp full example.
Basically I can do this
collection[id][prop] = value;
but not
var idProperty = collection[id][prop];
idProperty = value;
I have marked this point in the freeCodeCamp code with a comment.
This is obvious why I can't do this, but I don't know how else to do it. Thanks alot :-)
1 Answer
Steven Parker
243,318 PointsIt looks like you're trying to create a reference or alias. This is a feature of some languages (C++ for example), but it's not available in JavaScript.
jsdevtom
16,963 Pointsjsdevtom
16,963 PointsThanks!