Not Understanding JavaScript?Not Understanding JavaScript?

I’m teaching myself how to code. I’m pretty confident with my HTML and CSS skills, but I’m struggling with JavaScript. I’m using a combination of Tree house, Colt Steels’s Udemy course, and Jon Duckett’s JavaScript and jQuery book.

I get the concepts and syntax. I understand what loops, functions, arrays, and DOM manipulation is/does, but when I go to work on a practice project, I get stumped and can’t seem to figure out what I need to do to get my code to work. I’ve tried making tic-tac-toe game, a calculator, and a drum kit.

How do I get the information I’ve learned to stick and how can I start thinking like a developer?

Hi, HTML and CSS are markup languages, which are designed and used in context where problem-solving is not part of the task, you are mostly coding a layout. On the other hand when you program for instance in JavaScript problem-solving and creative thinking are part-of the task, training these skills require much more practice than learning the syntax of the programming language. Practice is the way to master this skill, but also learning Design Patterns for the type of programs you encounter in your tasks helps a lot.

1 Like

Hi there, A lot of us can relate to how you feel. I’d say it helps to not reach out too big for certain projects too soon. Each time you complete a certain exercise, if it was a challenging one, then back up and redo that same exercise a couple more times for repetition. (repetition helps things stick better)
I’m in the same boat, pseudo self-learning, and I can relate to these issues as well.
Sometimes, I feel that if i’m working on a problem and I can’t find the answer, even after looking on a few other sites, I feel that maybe it’s not working because some sites are running diff vers of JS. (Not sure this is really true or not) But case in point, I might try a regular expression on one site and the site shows that my regex should be working, but when I try it in the freecodecamp screen I’m working with, it shows there is a problem with it. So it can seem really frustrating at times.
I’m trying to remind myself to not spend too much time searching all over the place for an answer that works on one site, but not when I implement it on codecamp for some reason.
Passing it through the forum is a better learning curve when stumped after searching around.
Good luck, keep on trying

1 Like

Don’t teach jQuery. You must resolve many problems to have logic thinking.Don’t quit.

Hi,

That’s bacause you lacking experience, and you can gain it on your own by practice.
You could try for a start to practice some simple algorithms, just to learn logical thinking. On code wars you can find some of them.

This article can help you also.

Cheers

2 Likes

3 posts were split to a new topic: New to JavaScript - Help

Hello Chandler1,

I feel your frustration. It’s all of those maths examples that confuse me.

First of all, ‘teaching yourself’ is somewhat mythological because you use a source to learn from, in your case Treehouse, Colt Steele and Jon Duckett; they are your teachers.

JavaScript can be challenging.
You have done some projects; code alongs? Try code alones. What I mean is, after doing a code along, try making a similar app on your own. That way you can practise what you learnt in the order you learnt it.

Another thing to do is try to get out of the tutorial environment and think of your own project. I haven’t done a tic-tac-toe game, calculator or drum kit. I was thinking of making an electronic keyboard because my wife won’t let me have a keyboard.

To think like a developer, develop your own things. It will force you to think of all aspects of the program. For example, I did something over the last few days that really got me thinking about what I wanted a program to do, and it stretched my coding ability. I thought it would be fairly simple, but the more I went into it, the more things I discovered needed fixing. My project was to develop an ACT essay writing practice program to help my ACT students practice essay writing under timed conditions. Here’s what I thought about and the process I went through:

  1. The program should allow students to write essays.
  2. A timer should disable the page when time is up.
  3. The program display the number of characters remaining (down from 10,000).
  4. The essay is stored in local storage as it is typed.
  5. The program makes a file from the essay (pass local storage variable to php from a form).
  6. The program e-mails the essay file to the student and tutor.

Once I knew what I needed to do, I started making each part at a time.
I originally had a setInterval timer, but found out that they are inaccurate. I found a great tutorial on Wes Bos’ Javascript 30 course to deal with that. So, I got the timer working and all of the disabling and enabling of different elements.
I got the essay into local storage, but I was flummoxed at trying to get it into php. Stack Overflow to the rescue. Hmm, it was a simple case of passing the essay string via a hidden form input to the php script.
Next was how to actually send an attachment. phpMail makes it hard work. So I Qwant searched and found a script called phpMailer, which seemed to be extremely popular. I got that running after a few snags.
Everything worked well, or so I thought. There were issues with the character count and every key down counting the counter down. I did more Qwanting and discovered event.key. I coded a regex for the characters that I wanted to count down the counter as an initial condition for an if block, I then had to exclude the event.keys that a user presses but should not have a value (Shift, Tab, arrow keys…) so they did not count the counter down. The thing then was that deleting needed to increase the counter.

Anyway, I won’t go on any longer. I learnt a lot by completing my own project. You should see that creating your own wok and getting stuck is an opportunity to learn how to do something and get into the habit of searching for solutions. My code may be messy and inefficient, but as I improve, I should be able to refactor it.

This is a very common situation among beginners who are learning from online resources. I’ve there myself as many others have as well, I know exactly what you are going through. I have one good new and a bad one. Good new is that you can overcome this problem and learn, the bad new is that it’s going to be much harder to learn a programming language than HTML and CSS and probably not as fun, at least in the beginning.

How did I do it? Personally I watched videos and coded along instructors to build simple apps with pure JavaScript, I then tried to analyze the code and whatever piece of code I didn’t fully understand I’d go back to the tutorial and watch it again. I also used different resources to learn JavaScript and develop my problem solving skills, I found the FFC curriculum very good for the latter.

Practice and consistency is key when you are starting out, I suggest you to build as many projects as you can because this is the best way to retain all the information and for things to finally make sense.

1 Like