These JS "lessons" just tell me what to do but don't explain why or how it works

I can go through the lessons and usually understand what I have to do, but there is usually no explanation of what the code I’m writing is doing. So yes I’m completing them, but at the end I don’t feel like I understand what I’ve done. There should be a little snippet on EVERY step saying exactly what the code is doing rather than just “Write this code”. Even if its redundant, that redundancy is gonna help people remember and understand what their doing.

5 Likes

A lot of them do describe what you are trying to accomplish overall, although I’m sure it can get lost in the details sometimes.

Do you have a specific example and a suggestion for an explanatory snippet?

1 Like

Well that’s the problem, they tell you what you’re accomplishing but they don’t explain how it’s being accomplished. For of loops is a good example, I know they touched on it briefly, but it was something along the lines of “Type this”:

-- solution removed by mod not really needed for this discussion

Ok, I can type that and it works, but I have no idea how to implement it myself and when it would be useful, this is from the advanced dice game, and on this step they don’t even tell you to use a for of loop, just say you have to find the matching numbers then sum all the dice. So I’m trying to use different array methods that have been touched on a lot through out the course, (find(), includes(), etc ) then it turns out to be this thing they never clearly explained. I kinda looked back to see if i could find where they touched on for of loops initially but I couldn’t find it and I dont want to spend hours looking. Doesn’t matter anyways, they should re explain things when they come up again, that repetition is what’s gonna help people remember these things. But they could say what num represents in the loop, how the code decides what’s going to be used for num, actually explain HOW it works.

1 Like

Can you share what step this is please?

This is from step 7. The code is the solution to 7

Which Step 7? There are many

He meant the dice game project (the function getHighestDuplicates is from that one)

FYI, you’re not the only one who’s noticed this issue. You can review this post for eg where I made similar comments What is the point of 'Learn Functional Programming by Building a Spreadsheet'? Seriousy? - #15 by hbar1st

If you look at the responses, it will give you an idea of how hard it is to address this issue.

Is this the step?

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/review-algorithmic-thinking-by-building-a-dice-game/step-7

I just want to confirm this is correct and we’re talking about the same thing bc you characterized the instructions as “Type this”.

Now that you’ve completed this task, do you have a specific suggestion to improve the instructions?

I mean if you were to totally re-write the instructions, how would you write it?

1 Like

What I understood from the OP was that he was surprised by the seed code given in the next step which he believed to mean that he should have used a specific type of for of command to complete step 7.

Of course we know that he didn’t actually need to write it exactly that way (any code that accomplished the requirements would have worked as I recall). But that’s the impression he got I guess.

So, maybe adding something like “iterate through the array using a for loop to accomplish this” might be enough?

EDIT: Although if you were to write code that accomplishes the task and passes the test, and then see a better or different way of doing it when the seed code of the next step loads, I think that’s a good learning experience as well.

No this specific project does rewrites on all the steps pretty much. Maybe some people are taken aback when they realize it (they write code and it gets erased on the next step) while others peak ahead to get the solution and are confused that the step didn’t specifically say to do things that way. There’s maybe an overall misunderstanding happening in this project as a whole.

The main point of the post is that concepts can be explained more thoroughly. I just used this project as an example cause its the one I was currently working on. and iterating through a for loop I can do, that’s been used a lot through out the course. It’s for…of loops that didn’t get much attention. You could also give examples of other methods that would work if there’s a few different ways to do something. and saying things like “iterate through a for loop” to someone who doesn’t understand how a for loop works isn’t going to help them understand it. Maybe try breaking it down as much as you can
for (let i = 0 ;this is where the loop starts
i < 5; i++) i will increase by 1 each iteration (or loop) until it is no longer less than 5, so in this example it will iterate 5 times
{
const randomDice = Math.floor(Math.random() * 6) + 1; each iteration will generate a random # between 1-6

diceValuesArr.push(randomDice); that random number will then be "pushed" to the diceValuesArr array

so I dont even know if I explained that properly, hell I don’t even know why the one line got its own box! but I think something in that format where it breaks it down completly and explains exactly what each part of the code is doing would be helpful. And have an example of this anytime a concept is brought up, repetition, repetition repetition, beat it into our brains! Maybe put it in accordians or links or something

This project is probably not the best one to get at your point, if I understand you. This project gives more flexibility and focuses on the purpose you need to achieve instead of the specific syntax you must write, unlike previous projects.

I’ve been doing the projects sequentially, so if this isn’t where I’m supposed to be at then the projects are in the wrong order. Since this one IS more flexible and isn’t holding your hand as much as the previous ones(which is fine, honestly more of those peppered in as tests could be beneficial) this is the project that made me realize that even though I can follow the instructions and make it to the next step, I’m not actually gaining a proper understanding of the material.

I’m not saying that this isn’t where you’re supposed to be, more that this project isn’t the best illustration of what you seem to be saying. This project is about meeting goals rather than specific syntax.

I would agree that the new curriculum largely doesn’t do a great job on teaching syntax or big picture concerns at this point because you are always down in super specific weeds, but people are trying to fix that as they improve the curriculum.

This project is the first that starts to give more zoomed out steps, but I don’t think it talks well about how those pieces will fit together to make a whole and I’m not sure how to do that best.

oh! apologies, yeah you’re right, I was just using this as an example. Going forward I’ll try to provide more specific examples as I’m going through if that’s more beneficial for you. But I seriously think having breakdowns of different examples of code and explaining it to people in the most basic terms possible would really help people who are struggling. I realize that’s a lot of work for you though. I could probably make better use of the forum for clarity as well.

Reading code that is already written in a different, harder skill than writing code and I’m not sure it would help.

For this one, I think more of a high level overview of the big pieces before the coding starts might help?

I think you should just call it a test instead of a review. The positive of this for me is I know that I need to go back and review a few things. So I’m gonna watch a few tutorials, try to implement some things into my own projects and come back to it in a few days.

1 Like

Same. I went to Codecademy to just do the free version of the beginner JavaScript it’s a quick read and practice that is very easy you just don’t get do the projects which I’m fine with because I’m going to come back and finish the freeCodeCamp JavaScript for more practice and the projects. I read online from someone saying that Codecademy is for beginner/easy learning and freeCodeCamp is for bettering the learning and skills.