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

fix(challenges): Improve description in existing object challenges #15833

Conversation

Manish-Giri
Copy link
Contributor

Pre-Submission Checklist

  • Your pull request targets the staging branch of freeCodeCamp.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/signin-issue)
  • You have only one commit (if not, squash them into one commit).
  • All new and existing tests pass the command npm test. Use git commit --amend to amend any fixes.

Type of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Add new translation (feature adding new translations)

Checklist:

Description

Collecting suggestions from #12141, this PR improves the description in three of the introductory lessons on objects. The set of modified descriptions is intended to lay the platform for a new challenge which would require the camper to have knowledge on accessing object properties with bracket notation, among other things.

Eventually, this will make solving the "Profile Lookup" challenge much easier (see #15616).

Closes #12141

@BerkeleyTrue BerkeleyTrue added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Sep 2, 2017
Copy link
Contributor

@dhcodes dhcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Manish-Giri good work; let me know what you think of these suggestions.

@@ -4180,6 +4180,9 @@
"Here's a sample object:",
"<blockquote>var cat = {<br> \"name\": \"Whiskers\",<br> \"legs\": 4,<br> \"tails\": 1,<br> \"enemies\": [\"Water\", \"Dogs\"]<br>};</blockquote>",
"Objects are useful for storing data in a structured way, and can represent real world objects, like a cat.",
"In this example, all the properties are stored as strings, such as - <code>\"name\"</code>, <code>\"legs\"</code>, and <code>\"tails\"</code>. However, you can also use numbers as properties. You can even omit the quotes for single-word string properties, as follows:",
"<blockquote>var anotherObject = {<br> make: \"Ford\",<br> 5: \"five\",<br> \"model\": \"focus\"<br>};</blockquote>",
"However, if your object has any non-string properties, JavaScript will automatically typecast them to their corresponding string types.",

This comment was marked as off-topic.

@@ -4349,11 +4353,11 @@
"id": "56533eb9ac21ba0edf2244c9",
"title": "Accessing Object Properties with Variables",
"description": [
"Another use of bracket notation on objects is to use a variable to access a property. This can be very useful for iterating through lists of the object properties or for doing the lookup.",
"Another use of bracket notation on objects is to access a property which is stored as the value of a variable. This can be very useful for iterating through lists of the object properties or for doing the lookup.",

This comment was marked as off-topic.

This comment was marked as off-topic.

"<blockquote>var someProp = \"propName\";<br>var myObj = {<br> propName: \"Some Value\"<br >};<br>myObj[someProp]; // \"Some Value\"</blockquote>",
"Here is one more:",
"<blockquote>var myDog = \"Hunter\";<br>var dogs = {<br> Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"<br >};<br>var breed = dogs[myDog];<br>console.log(breed);// \"Doberman\"</blockquote>",
"<blockquote>var dogs = {<br> Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"<br>};<br>var myDog = \"Hunter\";<br>var breed = dogs[myDog];<br>console.log(breed); // \"Doberman\"</blockquote>",

This comment was marked as off-topic.

"Here is one more:",
"<blockquote>var myDog = \"Hunter\";<br>var dogs = {<br> Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"<br >};<br>var breed = dogs[myDog];<br>console.log(breed);// \"Doberman\"</blockquote>",
"<blockquote>var dogs = {<br> Fido: \"Mutt\",\n Hunter: \"Doberman\",\n Snoopie: \"Beagle\"<br>};<br>var myDog = \"Hunter\";<br>var breed = dogs[myDog];<br>console.log(breed); // \"Doberman\"</blockquote>",
"Bracket notation is also useful when you have to access a property whose name is collected dynamically during the program execution, as follows:",

This comment was marked as off-topic.

@Manish-Giri
Copy link
Contributor Author

@dhcodes on it...

@QuincyLarson
Copy link
Contributor

@Manish-Giri Thanks for helping improve these. Have you had a chance to look at @dhcodes's suggestions yet? We're excited to merge this.

@Manish-Giri Manish-Giri force-pushed the fix/improve-existing-object-challenges branch from 18480ab to d8eb2b8 Compare September 19, 2017 13:33
@camperbot
Copy link
Contributor

@Manish-Giri updated the pull request.

@Manish-Giri
Copy link
Contributor Author

@dhcodes @QuincyLarson Done!

@dhcodes
Copy link
Contributor

dhcodes commented Sep 20, 2017

QA'ing now.

"Here is a sample of using bracket notation to read an object's property:",
"<blockquote>var myObj = {<br> \"Space Name\": \"Kirk\",<br> \"More Space\": \"Spock\"<br>};<br>myObj[\"Space Name\"]; // Kirk<br>myObj['More Space']; // Spock</blockquote>",
"<blockquote>var myObj = {<br> \"Space Name\": \"Kirk\",<br> \"More Space\": \"Spock\",<br> \"NoSpace\": \"USS Enterprise\"<br>};<br>myObj[\"Space Name\"]; // Kirk<br>myObj['More Space']; // Spock<br>myObj[\"NoSpace\"]; // USS Enterprise</blockquote>",
"Note that property names with spaces in them must be in quotes (single or double).",
"<hr>",
"Read the values of the properties <code>\"an entree\"</code> and <code>\"the drink\"</code> of <code>testObj</code> using bracket notation and assign them to <code>entreeValue</code> and <code>drinkValue</code> respectively."

This comment was marked as off-topic.

Copy link
Contributor

@dhcodes dhcodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for sounding fickle, but it still doesn't flow right. I think if we rearrange some things and change a few words, it will be perfect.

@@ -4184,6 +4184,9 @@
"Here's a sample object:",

This comment was marked as off-topic.

@raisedadead
Copy link
Member

@Manish-Giri ping!

@raisedadead raisedadead force-pushed the fix/improve-existing-object-challenges branch from d8eb2b8 to a6d031a Compare November 1, 2017 04:59
@camperbot
Copy link
Contributor

@raisedadead updated the pull request.

@raisedadead
Copy link
Member

@dhcodes I have gone ahead and made the changes as you recommended. Can you please give this a merge after a look.

Thanks.

@dhcodes
Copy link
Contributor

dhcodes commented Nov 1, 2017

LGTM @raisedadead 👍 🎉

@dhcodes
Copy link
Contributor

dhcodes commented Nov 1, 2017

Thanks @Manish-Giri 💯

@dhcodes dhcodes merged commit 936223a into freeCodeCamp:staging Nov 1, 2017
@BerkeleyTrue BerkeleyTrue removed the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Nov 1, 2017
@QuincyLarson
Copy link
Contributor

@Manish-Giri Thanks for improving this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants