Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement - Change the names of the properties to be without "" so it is less cofusing #12125

Closed
lh15 opened this issue Dec 20, 2016 · 7 comments
Labels
status: discussing Under discussion threads. Closed as stale after 60 days of inactivity.

Comments

@lh15
Copy link

lh15 commented Dec 20, 2016

Challenge Accessing Objects Properties with the Dot Operator has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

// Setup
var testObj = {
  hat: "ballcap",
  shirt: "jersey",
  shoes: "cleats"
};

// Only change code below this line

var hatValue = testObj.hat;      // Change this line
var shirtValue = testObj.shirt;    // Change this line
@raisedadead
Copy link
Member

@lh15 Can you please explain more about what's confusing about the instructions? Thanks.

@raisedadead raisedadead added the status: blocked Is waiting on followup from either the Opening Poster of the issue or PR, or a maintainer. label Dec 21, 2016
@lh15
Copy link
Author

lh15 commented Dec 22, 2016

In the original broken code, hat, shirt and shoes are in ""(strings), however when accessing via a dot, strings dont work.
`// Setup
var testObj = {
"hat": "ballcap",
"shirt": "jersey",
"shoes": "cleats"
};

// Only change code below this line

var hatValue = testObj; // Change this line
var shirtValue = testObj; // Change this line`

@raisedadead
Copy link
Member

I can pass the challenge with:

var testObj = {
  "hat": "ballcap",
...
...
};

var hatValue = testObj.hat;      
...

That is with the original code.

Can you post a few Screenshots of the issue, with the tests not working in your case?

@lh15
Copy link
Author

lh15 commented Dec 22, 2016

So it works and passes the test. I just think that for a newbie, the fact the in the object then names are "strings" and when you access it in var hatValue = testObj.hat;, can be very confusing. Strings dont work when accessing the object. That was the trouble i had.

@raisedadead
Copy link
Member

Hmm, I can see how the seed code and the examples are creating a confusion, need to revisit this challenge, and the other object access challenges a bit more.

/cc @FreeCodeCamp/moderators thoughts?

@raisedadead raisedadead added status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. and removed status: blocked Is waiting on followup from either the Opening Poster of the issue or PR, or a maintainer. labels Dec 25, 2016
@systimotic
Copy link
Member

@raisedadead I agree. I've seen quite a few issues about dot notation vs. bracket notation. They show that the way we teach this isn't clear to many people. I'm not aware of whether the curriculum expansion takes care of this or not.
Some issues that I have recently come across that might be (somewhat) related:
#12141
#8207
#11882

I think removing the quotes in this exercise would be a good change, as it makes it more consistent with the description. Overall, I think we may need to revisit how we teach objects. It's not something that's easy to explain or understand, so I'm not sure if we could do better, but it's probably worth taking another look at it.

@raisedadead
Copy link
Member

thanks, @systimotic let's continue the discussion on #12141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: discussing Under discussion threads. Closed as stale after 60 days of inactivity.
Projects
None yet
Development

No branches or pull requests

3 participants