Skip to content

JavaScript - The Language

Conversations on Language

JavaScript is a programming language that we - as developers - write in order to add functionality to our websites. In this article, I want to explore what it means when we say “JavaScript is a language”.

What is a language?

In human languages, we see that they are made up of words, punctuation and grammar. English is a great example. The words you are reading right now are part of English. If you see a word you don’t immediately recognize – like philology – you can look it up in a dictionary to discover its meaning.

You’ve probably already recognized the other aspects: punctuation and grammar. Grammar helps you derive meaning from words. Grammar provides the rules for assembling and ordering individual words (think subject, verb, and object). Punctuation refers to special marks or symbols used to create structure by separating a series of words. Things like periods (.), exclamation marks (!) and question marks (?) affect meaning and interpretation.

Compare these two sentences:

  • Gerald is innocent!
  • Gerald is innocent?

The first implies confidence, while the second implies doubt.

But there’s one more characteristic of English: Names. We give names to people and places. Names are a bit different from the other words in the language in that you won’t find most people and place names in a dictionary. “Willamina” and “Wetaskiwin” are good examples. We even use names for certain things or objects, and with popular use those names occasionally make it into our dictionaries as legitimate words. Names tend to be things we invent. Examples include names for products (Lotusan®) and companies. Who can forget the mis-spelling that created Google?

As we grapple with understanding and using JavaScript, the first part of our journey is to recognize that JavaScript is a language.

JavaScript As A Language

JavaScript is a high-level language which software developers use to write computer programs. By “high-level”, we mean that the language approaches the understandableness of English (humans can read it and get an idea of what is happening).

A computer program is a set of instructions for manipulating information. — Dan Gilleland

But JavaScript is also a language that computers need to “understand”. Without getting into how the computer understands it, we can still explore the parts of the language.

Keywords, Operators, Identifiers, and Grammar

The code we write in JavaScript will be made up of the following.

  • Keywords are special words that are built directly into the language. They have special meanings and are used for specific reasons. Some examples include let, const and function. For a full list of the keywords and their meanings, see [AUTHOR TODO:]
  • Operators and Symbols are special characters and character combinations which play a role in performing specific operations (think addition: +) or in supporting the grammar rules of the language. The semicolon (;) as an example is similar to the period for English punctuation; it indicates the end of a statement (or sentence) and conveys that the statement is a complete instruction for the computer to perform.
  • Identifiers are like the names we use in English for people and places.

There are suprisingly few keywords in the JavaScript language. In fact, the huge majority of the code you write will involve identifiers or names that either you make up or that have been made up for you by the “JavaScript Runtime Environment” (think “Browser”).

Coming up with names for things can be a challenge! Ideally, names should be short yet meaningful. This whole aspect of a programming language which allows you to define your own names for things is called extensibility, and is a hallmark of high-level programming languages.

Grammar also plays a huge role. Again, you can think of grammar as referring to the rules we have to follow as we assemble our keywords, operators, and identifiers. The grammar of a programming language can be a bit technical, so in this site I will offer a simplified grammar that you can refer to as you are learning JavaScript.

Mastering JavaScript

When you look at JavaScript code, look closely at each part and ask yourself, “What is it?”

Is this part of the code a keyword, an operator or symbol, or an identifier? If it’s a keyword, then what is the syntax for that keyword, and how does it fit into the grammar of the overall instruction or line of code? If it’s an operator or symbol, what is the name of that operator/symbol and what is its purpose? That symbol might be there for grammatical or syntactic reasons, or it might be arithmetic, or something else entirely. Lastly, if that bit of code is an identifier, then what is its data type and its value, and how does it fit into the grammar of the statement/instruction as a whole?

Even learning how to define the terms I’ve been throwing around (syntax, grammar, identifiers, objects, etc.) will go a long way towards getting a handle on JavaScript as a language.

Conclusion

Learning (let alone mastering) JavaScript is an exercise of both reading and writing. Humans naturally learn to read before they write, and that applies to programming languages as well as human languages. Just as “location, location, location” is the mantra of real estate, “practice, practice, practice” is the mantra for learning a language.

When it comes to mastering JavaScript, the key is to constantly return to the fundamentals. Any skilled musician, singer, althlete, or public speaker will tell you the same thing. Revisiting and strengthening your grasp on the fundamentals is key. Reading code begins as an exercise of translating it into English (or whatever your primary language is). Reguarly writing code builds “muscle memory” as you repeatedly follow the grammar rules over and over again.

Eventually, these fundamentals become ingrained. Every once in a while, you will encounter something new that might challenge your understanding of what the “fundamental” are. Don’t be fooled - such challenges are vital to correcting potential misunderstandings that have crept into your mind. Even with years and decades of experience in coding, there is always something new and foundational left to discover!

Conversations on Language

The tutorials, how-to guides and references on this site are designed to expose you to both reading, writing and understanding JavaScript code. They focus on the fundamentals of JavaScript. I encourage you to revisit the pages of this site frequently as you embark on your journey to Master JavaScript!