Since val contains the key then using students[key] is like using students.keyname. Since the variable contains the key, we use the square brackets to access the value of the variable. Does that help?
yeah, Here comes the tricky parts: dealing with objects, arrays. Well explained. Some of the new ECMA features are really helpful! Array.from is one such new API.
My struggle is just* beyond this, but not far. Like finding the second lowest grade and returning the student email. Or if two students have the same grade, ignore the student with the email that’d come first in the alphabet. It’s starts to mess with my head when I don’t have a reference Val like how w/ arrays. Ex: var lowest = arr[0], If arr[i] < lowest, Lowest = arr[i]. I struggle w/ examples where you don’t have access to a properties dot notation, & obj[key] will update your ‘lowest’ var every loop.
Here is the way I would think of it: the JavaScript object is really an associative array. These methods make it easier to work with that data as you would expect with an array. Something else to be aware is that in ES6 a Maps collection was added that might fit your needs.
No fluff, just straight to the point.
Thanks again Steve! Can you please explain how you got the value using the val, as I don't understand how"val" didn't contain the key instead? 4:19
Since val contains the key then using students[key] is like using students.keyname. Since the variable contains the key, we use the square brackets to access the value of the variable. Does that help?
Very good explanation!
Glad it was helpful!
This was extremely helpful!! Thanks a bunch Steve!!
Very welcome!
Thanks for the awesome tutorial
yeah, Here comes the tricky parts: dealing with objects, arrays. Well explained. Some of the new ECMA features are really helpful! Array.from is one such new API.
Yes, I agree. Array.from is a great addition.
My struggle is just* beyond this, but not far.
Like finding the second lowest grade and returning the student email.
Or if two students have the same grade, ignore the student with the email that’d come first in the alphabet.
It’s starts to mess with my head when I don’t have a reference Val like how w/ arrays.
Ex: var lowest = arr[0],
If arr[i] < lowest,
Lowest = arr[i].
I struggle w/ examples where you don’t have access to a properties dot notation, & obj[key] will update your ‘lowest’ var every loop.
Спасибо, интересные методы работы с объектами.
How can we do sum of uniques items in object array [ {id :1,chat: 2},{id :1, chat:3}] result should be [{ id:1, chat : 5}] ?
I will have to add that to the list of possible tutorials.
Is it possible to use .entries in a way similar to an associative array?
Here is the way I would think of it: the JavaScript object is really an associative array. These methods make it easier to work with that data as you would expect with an array. Something else to be aware is that in ES6 a Maps collection was added that might fit your needs.
Line 20... should not we use let before Scores?
Yes, scores hasn't been properly declared. Thanks!
Excellent Vids!
please keep it up, I like your stuff 👍
Xcellente
Keep It Up