Wherefore art thou data help

Wherefore art thou data help
0

#1

So I’m trying to understand the project, and the main issue I’m having is I seem to not understand how the data we’re pulling works. It is obviously objects, but the example answer seems confusing. Because the last: Capulet exists, First: Tybalt, Last: Capulet is the according “pair” but by definition, shouldnt a pair require 2? The Last: Capulet seems to only be 1, yet it qualifies to match against the tybalt/capulet pair. Reading up on the object properties is helping but if someone could just give me a quick ELI5 rundown, that would be great.


#2

My understanding is that “pair” references the ‘name’: ‘value’ pairing within the object.

In arrays, values are paired with their key (their index location). So the code:

array = [“a”, “b”, “c”]; has hidden pairings. ‘a’ is paired with index key 0, ‘b’ is paired with index key 1, etc. But with objects we get to name the ‘key’. So instead of a key/value pair, like in arrays, we now get a name/value pair.

In the example, { last: “Capulet” }, ‘last:’ is essentially the named key, and it is paired with the value “Capulet”.

I hope that answered the question, and perhaps someone else will answer with a more definitive answer.

Good luck out there!