diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 797b22fcc86..05cd37df741 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -11,28 +11,26 @@ dashedName: using-objects-for-lookups Objects can be thought of as a key/value storage, like a dictionary. If you have tabular data, you can use an object to lookup values rather than a `switch` statement or an `if/else` chain. This is most useful when you know that your input data is limited to a certain range. -Here is an example of a simple reverse alphabet lookup: +Here is an example of an article object: ```js -const alpha = { - 1:"Z", - 2:"Y", - 3:"X", - 4:"W", - ... - 24:"C", - 25:"B", - 26:"A" +const article = { + "title": "How to create objects in JavaScript", + "link": "https://www.freecodecamp.org/news/a-complete-guide-to-creating-objects-in-javascript-b0e2450655e8/", + "author": "Kaashan Hussain", + "language": "JavaScript", + "tags": "TECHNOLOGY", + "createdAt": "NOVEMBER 28, 2018" }; -const thirdLetter = alpha[2]; -const lastLetter = alpha[24]; +const articleAuthor = article[author]; +const articleLink = article[link]; -const value = 2; -const valueLookup = alpha[value]; +const value = "title"; +const valueLookup = article[value]; ``` -`thirdLetter` is the string `Y`, `lastLetter` is the string `C`, and `valueLookup` is the string `Y`. +`articleAuthor` is the string `Kaashan Hussain`, `articleLink` is the string `https://www.freecodecamp.org/news/a-complete-guide-to-creating-objects-in-javascript-b0e2450655e8/`, and `valueLookup` is the string `How to create objects in JavaScript`. # --instructions--