I am taking the Basic Algorithm Scripting course and I have not completed any challenge on my own other than the first. In challenges 2-5 I read the hints and couldn’t do it, so I saw the solutions. I understood some (at least two of each challenge), but not all.
In doing so, I learned a little, but it hasn’t helped me improve my approach to the next problem (how to use the codes to get things done).
I started JS courses last Tuesday, so the codes are not really fixed in my head. And I don’t know much about some (.map (), for example).
So, I would like to ask which step should I take:
(1) I keep doing this and, at some point, I will understand?
(2) stop doing that and look out all the codes, understand them better, and find out how to use them for each problem?
(3) other?
The fist thing that you need to know is that this is hard. You’re now at a point where you’re not just expected to follow instructions for syntax. You need to take the time to creatively solve problems. While there are some things that you can learn by looking at hints and solutions, it won’t really make you better at solving this type of problem. I strongly urge you not to rely on looking at the solutions. It’s perfectly fine for these challenges to take a long time, to require research, or for you to ask for help.
It has been a week of learning javascript so you are not expected to remember everything. It takes time to get comfortable when you are learning something new. Patience is key. With practice and time things will start to make more sense.
I vote for other.
Algorithms help you learn how to problem solve.
Start with pen and paper and work out the problem without code.
Then write out the basic steps to solve the problem(ex. if this happens then I should do this)
Then slowly translate that into code.
It will help to have MDN Docs open for a reference.
I managed to do 4 challenges! = D
The first one was very big, but that’s okay. The second and third looked better. On the 4th I did and was fulfilling the checklist items (when looking at console.log), but it was not marking the item, as if it were wrong. I ended up looking for solutions quickly (sorry), to see if there were any similar ones. The only difference is that I was assigning “” to the variable, while the solution was assigning 0. I changed the “” to 0 and it worked. But I couldn’t understand why it was wrong with “”. If possible, could you explain the reason for this?
// Finders Keepers
function findElement(arr, func) {
let num = 0; // That was the variable that I was assigning "" (let num = "";).
for (let i = 0; i < arr.length; i++) {
if (func(arr[i]) === true) {
console.log(num + arr[i]);
return num + arr[i];
}
}
return undefined;
}
findElement([1, 3, 5, 8, 9, 10], function(num) { return num % 2 === 0; });