Learning HTML: Subpost 3

9 Jan

Javascript!

I am trying to learn how javascript works; it seems to be a rather confusing language. However, as the language of most of the interactive Internet as we know it, it is important to know.

To begin my research, I started at the well-written article at http://betterexplained.com/articles/the-single-page-javascript-overview/. This article explains, through examples, how Javascript works.

First of all, the language appears to be close to C, and its relationship with Java lies more in its name than in its structure. However, it is similar to Java in that it is an OOP, or “object-oriented programming,” language. This means that certain groups of objects can be made that inherit the properties of a class.

Apparently, all it takes to enable Javascript in HTML is a <script> tag. Who knew it was that easy? What surprises me the most is that you do not have to define a type for any variable; for example, in Java, you have to define a number as “double” or “int” according to the type you wish the variable to have. According to the examples provided in the website, all it takes is a “var = (whatever)” statement, and the machine will take care of variable type for you. Even with strings. As for classes, objects, and other good stuff, there is a protocol called JSON, or “Javascript Object Notation.” This notation is probably important for making code more readable. Arrays seem to be no-pain; they “grow dynamically,” to quote the website. It has nifty string manipulation tools, and can compare types as well as values. The conditionals and loops seem intuitive, and seem to parallel those in other programming languages. Functions and classes seem just as much easy to comprehend. You can even probe for errors using “catch” and “try.”

All in all, Javascript seems like a great language to program in, with much less syntactical and procedural burden as Java or C++, etc.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: