The beast that is JavaScript

I haven’t blogged in over a week, which sucks, but I’m glad that I had some time to reflect over everything I’ve learned over the last couple of weeks. There was a lot of info all at once, but I feel like being challenged like this has really helped me study and learn in a different way. Putting analogies together to better understand why things work the way they do has made learning some of this a joy.

First things first, Javascript can be a real bitch. One of the first things I learned when I went through coding my first javascript assignment was how easily a code can break if you even forget a single comma or semicolon. It really makes it a pain in the ass sometimes, but at the same time I’m really OCD about how my code looks on the page so I wan’t be as orthodox as possible with everything. Another thing about Javascript that I really didn’t get until about 4 days ago was the actual format of for loops and forEach functions. I realized how simple it was once I realized for loops have a basic structure that they usually use, and it was pretty much the same for the forEach method as well. Arguments and Callback functions can be whatever you want to call them which was something I originally wasn’t understanding, and that initially led to a lot of confusion on how I was supposed to define those forEach methods.

We did a few things today with prototypes and constructors. The basic layout of a typical constructor is simple because a constructor usually has a “new” in front of the function. Prototypes are something we had learned about a little earlier, but I also got a better understanding of them when I was able to try it out in console. The way I think of prototypes are that they’re just a link to another object. All objects have a prototype, so basically objects are chained together by prototypes. When I think of it that way, it just makes sense. One of the best things to do with javascript is to make it as simple as possible for yourself to understand with any analogies that might help you. I find that it’s really no different than if you were learning a language like Spanish or French. If you’ve ever studied other languages, you know that each language has rules on how certain things are used. Javascript is basically the same way in the sense that there are defined by certain rules on how you can use them. “this” method was another thing we went over, but that seemed pretty easy enough. It’s basically one of those object methods that works with the immediate member that it’s referring to. When used with a constructor, it’s limited to just that object. You’d have to define “this” again for a newer object.

JQuery has actually been a painless thing for me so far. I say so far because who knows what’s ahead. The best thing about using something like JQuery is that you can template a lot of things when trying to pull information. We have a current assignment to do with recreating our GitHub profile pages. The easiest way to do that with using JQuery is by templating the info so that you can make it easy on yourself to keep your HTML clean as well as reference everything from your Javascript file. Using $.when to do multiple, parallel queries was something I didn’t grasp until I saw an example of how it was used today. When I saw it used, it was basically linking the API’s together with your template pages which are where your info basically is going. That info on the template pages then goes to your HTML using innerHTML on your javascript file with query selector. All in all, it’s a process I can get used to doing whenever I want to template things to grab multiple sets of data from an API.

With all that I’ve learned so far in about a week and a half with Javascript and JQuery, I’ve realized this is just the tip of the iceberg. There are many things to learn, and it will definitely get more complex with the more things we experiment with. But that’s really what makes it fun in a way. It’s a challenge, a new way to think about things whenever you learn something new. This is only week 4 and I feel like I’ve come way with a lot of understanding since the clock project. I can’t wait to see how my skills progress by week 8 or 9!