And I know, much of what we publish here is geared towards those who already have experience in writing web applications or doing something in web development. But that's that not the target audience for this article.
Let's get started.
Alternatively, Wikipedia defines it this way:
- High-Level. When a programming language is high-level, it's considered one that's built without needing to know finer details about the underlying computer. You don't have to manage memory, you don't have to know what type of processor is running, and you don't have to deal with things like pointers (such as in languages like C or Assembly).
Dynamic. Languages that are dynamic allow developers to extend certain aspects of the language by adding new code or introducing new objects (such as a
Untyped. If you have any programming experience, then you've likely come across certain types of languages that require you to declare the type of variable with which you're working. For example, perhaps your variable will store a
Now that we've covered the attributes of the language, we can discuss certain aspects and nuances about the language.
Though all of the above is important, it's also essential to know how the language works (especially if you've worked with other languages) so that you don't go into development with pre-conceived ideas as to how it might work or how it should work.
Instead, I'd rather cover how it does work so that you can get started writing code and understand exactly what it is that you're doing.
About the Language
String, are based on prototypes.
This allows us, as developers, to add additional functionality to the objects through the use of prototypal inheritance:
Prototype-based programming is a style of object-oriented programming in which behaviour reuse (known as inheritance) is performed via a process of cloning existing objects that serve as prototypes.
I'd argue that if you've never worked with an object-oriented language before, then you may have an advantage at this point because you have no conceptual model to shift in order to think about how this works.
If, on the other hand, you have worked in these types of languages then I think it's worth distinguishing how prototypal inheritance differs from classical inheritance:
- In classical inheritance, we, as developers, will write a class. Multiple objects can be created from this single class. Furthermore, we can then write another class that inherits from this class and then create instances of those classes. In this situation, subclasses are sharing code with their base class. So when you create an instance of a subclass, you're getting the functionality of both the subclass and the parent class.
- In prototypal inheritance, there's no such thing as classes. Instead, you simply define an object and introduce whatever functionality is necessary. When you want to add functionality to an existing object, you do so by adding it to the object's prototype. If you attempt to call a method on an object such as
Numberthen it will first look for the method on that object. If it doesn't find it, then it will move up the chain until it finds the method (which may live on the base
Finally, and perhaps the most important thing to note, is that when you make a change to an object via its prototype, then it's accessible to everyone who uses that object (at least within the context of your environment).
It's really powerful, it's really cool, but it also takes a slight shift in thinking if you're not used to working in an environment like that.
This could be introducing an element, removing (or hiding) an element, or things like that. Then the web advanced a little bit and browsers were able to make asynchronous calls to the server, handle the response, and then change the state of the page based on this response.
But it's matured even beyond that.
"What Should I Expect From the Language?"
Regardless of whether you're new to the language or you're looking to learn a new language when you've come from another background, you've got a level of expectations as to what the language can offer.
And though we've talked about how the language works from an internal perspective, we haven't really talked about the objects that are available in the language, let alone APIs. To be honest, covering the APIs and built-in functions in the language would be an article all its own.
But covering its built-in objects? That's something we can review before ending this article:
- Object. The base object from which all other objects inherit some of their basic functionality.
Boolean. This object serves as an object wrapper for a boolean value. In many languages, booleans are a data type that's either
Number. In many programming languages, there are primitive types such as
Remember that all of the types that you see above are objects with properties (and functions) of their own that you can call. This doesn't mean that you need to call constructors to instantiate your variables. That is, you can create strings and booleans and numbers like this:
var example_string = 'Hello world!'; var example_boolean = true; var example_number = 42;
But, ultimately, they are still objects.
To be clear, these are the basic objects. There are far more advanced objects that are worth exploring, especially if you're going to be working with error handling, various types of collections beyond Arrays, and so on.
If you're interested in reading more about these, then I highly recommend checking out this page in the Mozilla Developer Network.
What Libraries and Frameworks Are Available?
- jQuery is a library that aims to provide a cross-browser API that allows you to "write less, do more."
- Backbone aims to give structure to web applications through the use of models, collections, and views.
- Ember.js is another framework for "creating ambitious web applications".
- And more.
Creating Single Page Applications With WordPress and Angular.js
The Genius of Template Strings in ES6
Testing Angular Directives
Of course, not everyone works on the front-end. Some are purely server-side developers; some are purely client-side developers. Nonetheless, we all have to work together to make sure the various parts of our applications are communicating with one another.
If you've enjoyed this article, you can also check out my courses and tutorials on my profile page, and, if you're interested, you can read more articles specifically about WordPress and WordPress development on my blog.