Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Well, that's weird.
Hello, as I was watching this video I saw this:
Why is he using the same value on the set()? I am a bit confused about this. If someone would like to clear things up for me I would be very grateful.
Thank you very much. Stavros
Pavel Trofimov12,535 Points
Unless I'm looking at a different part of the video, he's using
The second parameter is without quotes. So I think what's happening is he's setting the key name first (that's "stevenJ"), and then the value (which is the object assigned to the variable stevenJ).
well there is nothing wrong or wired doing this
classroom.set('stevenJ', 'stevenJ');. You can set the key same as it's value. so getting the value will result in
classroom.get('stevenJ'); stevenJ, or what else you can do is.
let stevenJ = "anyname";
Now the key will be 'stevenJ' and it's value will be anything inside that stevenJ variable.