HI coders,
I’m doing Javascript course,but I’m finding several difficulties in understanding certain concepts,In particular with the latest topics (maybe I’m not good enough).
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.
For example:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops
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]];
By doing myNestedArr[0]
, you’ll get [1, 2]
; if you do myNestedArr[0][0]
, then you’ll get 1
.
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” 1
from 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 product
and assign the result tovar product
. This way, the value insidevar product
will keep getting re-assigned until it’s been multiplied with all the numbers inside the nested array.
Hope this breakdown helps.
I have problems in Javascript. Im at the end of it and i feel like I haven’t learnt how to use it.when they give me instruction I can’t follow it unless there are examples after the instruction. So i go to the hint and just copy it there.
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!