These are chat archives for FreeCodeCamp/Help

5th
May 2019
Nelson J
@nelsonaj
May 05 05:58
Hey guys I'm back after a long break trying to learn to code. About 2 weeks ago I started again and I have been going through the teamtreehouse full stack javascript. I have been working on a problem since yesterday, yesterday evening for like 2 hours and today like 3 hours until I solved it and now I have it working I can see that there is a lot of DRY code. I saw other's solution without actually looking at the code because I don't want to copy and paste or cheat, theirs are shorter. So I don't know how to feel but I am not quitting this time. It is a program that it iterates through an object of students, it prompts user to search student and if search matches student in object, it displays that student. But it's so DRY that I don't like it. What I did was to use a while loop and a bunch of else if statements for each student. That's repitive . Should I ask for ideas or redo it until it's shorter?
Henry
@GitHub-Henry
May 05 07:24
As you get experience your code will get better. How much time do you have to redo code that works?
webhll
@webhll
May 05 10:49
你的a元素应该使用"cat photos"作为其anchor text(锚点文本)
alpox
@alpox
May 05 11:13
@nelsonaj You can go with more functional approaches although its good to learn the iterative approach first.
Later you can learn about .find and .filter as example
If you want to find a student in an array of students by parts of his name (just as example):
const matchedStudent = students.find(student => student.name.includes(searchString));
@nelsonaj It takes quite some time to learn different kinds of approaches but you'll get there. No master fell from heaven :) its all just practice
Tamara HJ
@Tamara122
May 05 13:03
I am stuck in the last two questions in basic java script
Would any one help
Philip Durbin
@pdurbin
May 05 13:05
Which questions?
Jake
@JakeDVirus
May 05 18:33
a simple question. is it necessary to remove the event listeners when not required. lets say i have added a event listeners, to an element, only for mobile screen size. Shall i remove the event listener for remaining screen sizes for efficiency etc, or there's no downside (from efficiency perspective) if i dont remove the event listener?
Nelson J
@nelsonaj
May 05 19:45
@alpox but I would need to learn about functional programming and about .find and .filter to solve it and I need to come up with a solution based on the knowledge I have gained from the curriculum so far. That would be cheating, wouldn't it? I have only gone through variables, functions, arrays and and now objects but this is where I'm stuck at, I am not able to think about a cleaver way to solve it like other students have done which is why I feel kinda discouraged now.
alpox
@alpox
May 05 20:30
@nelsonaj No need to be discouraged. It takes time to get into the right mindset. More than half our class took about 2 years to really grasp the basics, some are faster some are slower with grasping the basics but later that doesn't matter anymore and none are better than others now
Nelson J
@nelsonaj
May 05 20:31
@alpox good thing is that no matter how discouraged i feel, I am not quitting. I'll be banging my head here for a while. Thanks for your feedback tho!
alpox
@alpox
May 05 20:36
@nelsonaj Btw. DRY code is a good thing :)
Nelson J
@nelsonaj
May 05 20:37
@alpox yea but I meant my is not DRY. It's just repetitive
alpox
@alpox
May 05 20:46
@nelsonaj you learn how to get around that with time and practice :)