Reminder: Key-Value Relashinships
Before we can take the next step in working with loops we first need to remind our-self the key-value relationship we learned when working with Object and Array
Video Transcript
00:00Before we could go into the next step of for loops so far
00:04We've seen the basic for loop and the different types of operations. We could do with it
00:09Now the before we could continue on looking at different ways of working with forward loops different variations of it
00:15We first need to remind ourselves of a concept. We've talked about earlier
00:20in one of our earlier videos about the objects
00:24And we've said that an object is has a key value reference and so do arrays
00:29So just to remind that for a second. Let's just create quickly a new array LA
00:35com
00:36Alright, so that's enough. So we have our we have two values in our object if we wanted to retrieve
00:43the value of Ben valid the name then we would have to send it the key of
00:48the key value name
00:51the key
00:53Name, which would return then the value of Ben valid, right? So we're sending the key and then the value
00:59and
01:00That relationship that we've seen which is again
01:03We were saying key and value is a very important one to to remember because a lot of different things work under this
01:12Under the structure so things in programming many times especially now
01:17we're starting to work with four different variations of for loops and
01:22In general working with objects, even if you don't see them
01:24They're they're key values such as if I would ask you what is the key value and a key value?
01:30you you might make that connection now as well as that the key many times is actually the variable or the property and
01:38The value is actually the value of that property or variable. So for example, it would this still be a key
01:46Definitely. So trace. Oh dot site
01:50It's still a key we're sending the key site to retrieve the value of everything affiliate calm
01:56Alright, so even if we have different ways to interact sometimes where we could use the dots index
02:02Which is the standard in most scenarios?
02:04we have our array which which requests us to send it an
02:08integer of a position to retrieve a value so a key in an array scenario would be an
02:16integer while a key in an object could be a string as well and
02:22When we create variables or we create properties for an object and even for example if I just created Oh
02:29Key two equals value two which is another way of creating another key or another property or another
02:37variable that belongs to that object
02:40So that that's really just that quick reminder reconnecting back to objects because we're going to see in the next few videos
02:48Some special features that we could use in for loops
02:52Which are for in and for each in that both correlate to the key value property
02:58So if we understand this concept, well
03:01Then it's going to be really easy to understand it's going to be very fun to work with the for in and the for each in
