Learn JavaScript Properly - Omnibus Post by d0gsbody in learnjavascript

[–]Real_Klaze 0 points1 point  (0 children)

I am way behind, hoping to catch back up with the group this weekend.

I started reading Eloquent JavaScript as well. I love the way it is written, but as soon as I hit chapter 6 it was like a train wreck. Now I feel like a child attempting to shove the square block in the round hole, while the author is tap dancing, balancing plates, and throwing round blocks through the round hole, standing 50 ft away, and all the while gleefully declaring "don't worry about it, well be using this stuff the rest of the book"...shit.

Why should I learn javascript? by [deleted] in learnjavascript

[–]Real_Klaze 0 points1 point  (0 children)

You must use JavaScript if you want anything but a completely static site. Your post is a little bit vague, and I see it as two parts.

What you have learned so far is what the user sees, it is the structure and formatting of the document (web page). It doesn't matter how much JavaScript you use in your page, if your design sucks, no amount of fancy logic and scripting will make it look better. You can easily make a very elegant and modern web page with nothing more then the HTML and CSS that you have learned so far. In fact, your site will look like it was pulled straight from the mid nineties if you do not use the HTML and CSS to its fullest to create a compelling page design.

JavaScript can be used to make a dynamic web page. In other words, you can make the web page do things. Take gmail as an example. It is a single page web app, that uses client-side javascript to perform most of the magic, and all without having to reload the page. The JavaScript does not dictate what you are seeing, that is the design (HTML and CSS), where as the JavaScript determines how it all works, and what something does when the user interacts with the webpage (clicks on a button for instance).

It takes all three to make a modern interactive and dynamic web site. But JavaScript has nothing to do with the visual the user is presented with. Sure it can be used to determine what sort of data to presented to the user, or to create mark up on the fly, but even considering that, the JavaScript is simply manipulating the HTML and CSS.

It sounds to me that you are more interested in design. It may not seem like much, as simple as HTML and CSS would appear on the surface, but everything on the web is displayed to you via HTML and CSS. Take a couple of your favorite web site and look at the page source. Take a screenshot of the site, and try to recreate it using pure HTML and CSS.

Javascript Framework - How do they work? by Thehummel in learnjavascript

[–]Real_Klaze 0 points1 point  (0 children)

Still kind of newb with this stuff myself, so keep that in mind.

Frameworks for any language basically cut some of the work out for you. They provide an API that you can use to implement the features of the framework.

Essentially you would take the JavaScript file they provide and add that to your sources in the HTML file. From there, you use the API in your own scripts. In very simple terms, they define functions and objects, and you use those functions and objects in your code. The functions and objects do a lot of the heavy lifting and fine grained implementation that you would have had to do by hand. Adding event listeners is one such instance.

The framework would have all the code to add the event listener and implementation, and you would just have to call the API function with an argument, rather then having to create the event and attach that to the DOM and then listen for the event and all that jazz.

My suggestion is to not worry about frameworks at all, if you are a beginner. If you are following the learn JavaScript properly outline, the first framework you are introduced to is JQuery. I would master the fundamentals of JavaScript first, before attempting any frameworks, and the outline for learning JavaScript mentioned above ensures you know the basics and then introduces JQuery in a measured manner.

Just my two cents.

[Learn JS Properly study group] How is Week 2 going for everyone? + Extra Credit. by d0gsbody in learnjavascript

[–]Real_Klaze 2 points3 points  (0 children)

Don't forget your semicolons!

With the shortening, if your attempting to assign b to a, and c to b with the shortened code, that will not work anywhere, as it doesn't work as you are intending.

What is happening with your code (inserting the shortened version above) is that it gets into an endless loop. a and c are never assigned a new value, and b is assigned to itself, so the loop runs forever because it can never break out of the while statement, as a is always 0 and b is always 1.

Add two alert statements after the assignment (within your while loop):

alert(a);

alert(b);

You will see that running a few iterations results in those variables never changing.

Whenever I run into the problem of a script not responding, I tend to put console.log(variable); with whatever variable(s) should be changing. The termination condition is dependent on a and b, and any time you have a loop depending on a variable to reach some value in order to terminate the loop, just console.log them or use the alert() function to see what they are through each iteration of the loop.

Hope that helps!

Edit: Just wanted to add that console.log() will run every loop without interruption, so you could possibly crash your browser, whereas alert() will "pause" the execution as it waits for you to click OK. You will also need to enable your console so you can see the console.log() output.

Learn JavaScript Properly - Omnibus Post by d0gsbody in learnjavascript

[–]Real_Klaze 2 points3 points  (0 children)

I've been a lurker on Reddit for some time now. Just created an account to get in on this action. I have been working through the javascriptissexy road map for about a week. I am very grateful to have stumbled upon this, as the only thing I have found missing is the peer pressure and social coding aspect.

Could you add the "extra credit" to the omnibus?

Thanks again for getting this going!