Finally made it past this challenge but it took me forever to figure this out XD The Get a hint solution gave a solution that worked but in the small piece of code there was a lot going on. To help other beginners I made a breakdown of the code and used color coding to explain each bit. Could someone take a look at this and see if the explanation is accurate?
Note: Forum posts do not support color coding. The breakdown can be viewed in google docs:
2 Likes
Basically, this is a pretty accurate breakdown. Two things jump out at me, though:
-
Note that in #6, youâre not only creating a new object, youâre implicitly returning that new object. By having some sort of value as the only thing following a fat arrow function, itâs shorthand for return that one value (whether a string, a number, an array, or an object).
-
Your item["title"]
is interchangeable with item.title
in this case. You arenât passing "title"
and "imdbRating"
as variable data, so it isnât strictly necessary here. Not saying youâre wrong, youâre truly not. but in this case, either would represent the same data.
But yep, thatâs a pretty clear summation, and I like that approach to note-taking.
This was really helpful, thank you! I understand arrow functions when I read them, but Iâm not yet able to spontaneously create them yet⌠I still have to write a regular functions and then progress from there. It makes sense that you have to wrap the new object in parentheses to differentiate it from a function.
Thanks again!
1 Like
Thanks for checking! item.name looks more familiar as well. I hope you donât mind, Iâve added your notes to the breakdown.
1 Like
This was really helpful, thanks so much for posting. Translating JS into English is a great tool for understanding how the parts work together, especially as the code starts to get denser!
1 Like