Maybe I’m doing something wrong, I don’t know…
I thank those who answer me in advance
Hi @camcode, I suggest you to be more specific with your problem (e.g. what part of the curriculum you’re having troubles with; if you’re struggling with some certain challenges, link us to them and show us your code); otherwise it’s hard for people to give you useful feedback. Cheers.
i’m stuck with record collection and nesting,because I don’t understand the logic behind
I saw help, but I still can’t understand it
Do you mean you read the solution but still don’t understand why things are the way they are? Or that’s not the case?
Please do add a link to the challenge, show what you’ve written so far, and what errors you’re getting. Because by “the logic behind” I still don’t quite understand what your problems are.
you hit the problem, I try a solution, I can’t and then I look at the guide, I copy the solution, but I still can’t understand why it came to that solution.
I see the solution ( I click “Get a hint”) and copy it ( I know that it’s incorrect).
I hope I have been as precise as possible and sorry
Nested array looks a little more complex than the array you’ve seen so far; but the way to access the elements in there is the same.
Take the nested array from the challenge for example. (I put it inside a variable, but doesn’t matter.)
let myNestedArr = [[1,2],[3,4],[5,6,7]];
myNestedArr, you’ll get
[1, 2]; if you do
myNestedArr, then you’ll get
As you can see from above, in order to access each single number in the nested array in this challenge, you need to chain two index numbers together; just like how you “unpacked”
let myNestedArr = [[1,2],[3,4],[5,6,7]];.
With that in mind, what the solution is doing is essentially:
arr[i]: Loop through each of the three sub arrays inside the big array (first for-loop)
arr[i][j]: Access each number inside each sub array (second for-loop)
- Take that number, multiply it with
var productand assign the result to
var product. This way, the value inside
var productwill keep getting re-assigned until it’s been multiplied with all the numbers inside the nested array.
Hope this breakdown helps.
Take notes. I wrote them down on Google Docs.
Act like you are teaching the concept to put it into simple terms in order to understand.
ok yeah didn’t think of that i being reading it over and over and i cant get it…
Good idea! That saves me from using flash cards!