12/14 - Am I just genuinely not suited to coding?


#1
$('.list').append('<div class="item">' + toAdd + '</div>');

I am trying to work my way through and understand this entire Tutorial as much as I can.

I started with html and css (which were fine/relatively easy as far as im concerned), then moved onto JS and struggled to pick that up.

I then stopped at circa 30% through JS to start jQuery as I've been told it is an easier way to add functionality to a web page, however it would seem that in ALMOST every question, I am either getting stuck, clicking the hint, or Looking at Q&A to seek out the answer/explanation.

My question is: Did everyone struggling learning anything more complex than html/css like I am? Or am I genuinely just not suited for coding? I won't say I don't understand ANY of it, cause parts of it I do, but I'd say 8/10 times I'm looking at the hints, googling or looking on the forums.

Is this normal?!

In relation to the question on the code, can someone try and explain what the code I posted at the start of this tread actually means?

Thanks in advance!! :smile:


#2

hi buddy!

at first time, don't you worry if you do that (search on google, bla bla bla), I made that too, when 3 years ago i started with code (html, css, etc..) , that's very important, that you don't stop over there, in the error, by the way, congrats for do that! :raised_hands:

So... in relation to your question, i'm going to do my best to explain to you! :wink:

$('.list').append

you need to remember, with this method: ".append" you're going to add a new element at the finish to wherever you want.

'<div class="item">' + toAdd + '</div>'

// This <div class="item">... (the new element that i'm talking, for your case, before) is going to added at the last of the list: $('.list')

example: every time that i'm going to click "¡Add!" in the program, whatever you had wrote, is going to added in the order, first the word: one, and then, after the previous word, at the last: (i mean, the next word), is added right over there where the word: two was added down here:

1. one
2. two
3. three...

i really don't know if i help you with this, but, that's my better example for you haha', have a nice day buddy, and don't stop of coding! :relieved: :wine_glass:

my best regards,


#4

I tend to get frustrated from time to time. What i've learned that works for me is that I write down all the stuff that confuses me and I search online for different answers. Also step away from Codecademy and go find a couple of small tutorials on other sites. It helps me.


#5

Heey!! You are just on the right truck. Dont you dare give up. W3School is one good platform to start with. Go try it if the academy seems more complex.


#6

dont worry, I finished HTML, CSS and java script and I find them fine, but now when I am doing jQuery, I don't understand most of them as well.... but I guess I should just practice until I get them.


#7

You're fine. It just takes practice. JQuery uses quite a few JS concepts and some JS syntax that you never before were exposed to in CSS/HTML. A lot of the quirks you see in JQuery are from the JS language. You may want to learn the fundamentals of programming by learning JS basics (or an easier language like Ruby or Python, then learn JS).

Before learning any web development, I was learning Python and had a tough time like you did. Now that I've learned the basics of programming and data structures in one language, learning a second one (JS) was a lot easier.

About your question:

 $('.list') ---> you are selecting the element(s) from HTML if their tag has ID="list"
 $('.list').append() ---> you are going to add something to the end of the list element's content. 
 $('.list').append('<div class="item">'+ toAdd +'</div>'); ---> you are adding a div to the end of the list content which holds what the user typed into the form input box.

But you may be wondering: why does the the stuff in .append() look so weird?? This is because it uses JS programming syntax. The single quotes (' ')s surround literal strings of characters that you want the JQuery to basically type into the HTML for you, like regular/unspecial divs, paragraphs, any tagged element, and regular unspecial text. The + 's are used to add the characters together. Since toAdd is a variable, it doesn't need extra quotes because its value stores text with quotes already.

This code in script.js:

 var toAdd = $('input[name=checkListItem]').val();

After typing into the demo's form input box, turns into the JS version inside your page:

 var toAdd = 'something you typed';

So then:

$('.list').append('<div class="item">' + toAdd + '</div>');

Is the same as this code if you typed it all by hand:

$('.list').append('<div class="item">' + 'something you typed' + '</div>');

Or:

$('.list').append('<div class="item"> something you typed without an input form box</div>');

I hope this helps you or a future person looking at this thread.


#8

I went the same route as you, HTML/CSS, then JS and JS was the most gruelling, frustrating code I dealt with, mainly because at the time I was new to coding. After forcing my self through the "10 hour course" in literally 30 hours and like 50-90 hours of pondering as I took breaks per 2% complete, I got through it. As every time I pressed the hint and forgot codes.

Now I do computer science as a course, and JS has rly helped me, because most codes are similar to it, with variables, functions and Object orientated programming. Once you power through it you should find other coding languages more easier to pick up. I used to look at the forums for answers all the time when I did JS, but I rarely look up answers for codes after I finished because I got the general gist of coding, once you learn the basics of one Programming languages, you knowledge correlates with new languages.

But if that hasn't had an effect on you start with an easier language like visual basics (which is similar to JS but pretty much in English) It's a great way to learn the basics, and it can be grasped by almost anyone.


#9

This is perfectly normal, I went through the exact same phase. Coding has a learning curve to it. It's generally confusing and frustrating in the beginning. The key is to not give up and stay focused.

Keep on working and practicing on solving real life problems. Good luck. :smile:


#10

Well Thanks to everyone for all of the support.

I never knew that the developer community was so kind and tight-knit!

I'll definitely keep on coding!

Today I started fresh after a 2-3 day break (after completing various html/css website projects on Codecademy) and re-started jQuery from the first tutorial, despite already completing 60% of it.

And you know what? It's almost like it's starting to make a little more sense!

Thanks again!

:kissing_heart:


#11

Coding is hard work. Often times a person has to retrain their brain how to process things because the way we code is not how we live.

If it was easy everyone would do it. There's a reason coder's get paid so well.

Just hang in there. I had the same struggles when I started school just 2 years ago and now I'm employed and getting paid nicely to do the work.

And like you just said above, walk away and come back. Sometimes that's all it takes.

Perseverance and hard work will pay off.


#12

Same here, I did HTML/CSS (easy) then JS. I thought I was going to be crazy. I literally saw NIGHTMARES about JS, always moving lines of incomprehensible code. But now it's kinda ok. I love JS and especially JQuery.

So brace yourself and keep on coding, you can do it!


#13

I also want to add that having done the HTML, CSS and the Javascript tutorials on this site, the questions and hints on the JQuery are not as clear as they should be. I recall an exercise on using the click function. It never mentions anything about calling a 'button' on a click function unless you ran the program and noticed the error message.

Unfortunately, I saw the message and decided to see what's wrong with the coding instead of checking the error message :unamused: Even on the hints section, it never gave me any indication of the problems I was having. I totally understand why some gets confused as I have been tearing my hair out on some occasions


#14

There is a lot to be said for just 'stepping away" for a bit. When I get frustrated, I quickly reach a point of 'no more gains" where I Just have to put it down and do something else. This give my brain a chance to ponder the problem in the background. Then I can come back to it with a "fresh set of eyes" and typically I can find the problem in a few minutes. I"ve been coding for a long time and JQuery is a pain. The syntax is odd and inconsistent - which appears to be a consequence of it's being written in JavaScript. (IMHO).