Frontend vs. backend technologies

One of the first things that we ought to understand before learning JavaScript is the difference between frontend and backend technologies.

If you're already familiar with this distinction, feel free to skip this entire section.

So what is a frontend technology and how does it differ from a backend technology?

To start with, the terms 'frontend' and 'backend' are most commonly associated with web development which is one of the most prolific fields of computer science and software engineering.

A frontend technology is basically anything that is concerned with building the frontend of a website or web application. The 'frontend' is simply whatever the user ultimately sees on his/her device.

The three core frontend technologies are HTML, CSS, and JavaScript. We can't imagine even any simple website today without these all three of these — they sit right at the heart of the web. Following from the increasing complexity of web apps over the years, we now have many new frontend technologies to help us in designing and adding interactivity to our web applications. They include things such as AngularJS, Vue.js, React, Bootstrap, Tailwind, SASS and so on.

On the other side of the mirror we have backend technologies.

A backend technology is simply anything that is concerned with the backend of a website or web application. The 'backend' refers to the web server. Hence, a backend technology is anything that runs or helps perform computational tasks on the server of a website.

Some highly popular backend technologies are PHP, Python, Ruby, Java, Go, Redis, MySQL, PostgreSQL, and lots and lots of frameworks built around these languages and database systems.

Before beginning to learn any new web technology, it's crucial to know exactly which category it falls in. That is, is it help us in building the frontend of a website or the backend of a website.

JavaScript, as we shall explore throughout this course, is a frontend technology. It allows us to add interactivity to web pages and make them resemble native desktop apps. But there is much more to JavaScript than just this one line of description. The next section dives deeper into giving an overview of what exactly is JavaScript.

What is JavaScript exactly?

JavaScript is a programming language created by Brendan Eich in 1995.

It's a high-level, scripting language that is parsed and executed by a web browser program.

By 'high-level' we mean that the JavaScript code is highly readable and very easy to write and reason about. It closely resembles natural English language whereby we don't have to worry about many of the internal complexities of machines when programming, in contrast to a low-level language such as assembly.

Being a scripting language means that it operates inside a virtual environment that's powered by another program, often called the engine of the language, in contrast to being compiled into native machine code and then run on its own.

The most popular implementation of JavaScript is the V8 engine, developed by Google.

It runs inside Google Chrome and is responsible for executing JavaScript in the browser. In other words, if we view a webpage on Google Chrome, its V8 engine parses all the JavaScript code and then executes it.

The V8 engine is written in C++ and is able to optimize JavaScript code to extremely efficient running times. It's even used in the popular server-side runtime environment called Node.js, where JavaScript powers the backend of a web application.

Besides V8, there are other popular JavaScript implementations as well:

  1. Mozilla has its own engine called SpiderMonkey. In fact, going back in time, this was the very first implementation of the language which merely interpreted JavaScript source code.
  2. Safari uses the engine JavaScriptCore.

The friendly competition of all these implementations with one another constantly transforms JavaScript into becoming more efficient than ever thought of before, all thanks to a theory known as JIT compilation.

What is an implementation?

A computer language is merely an idea, an abstraction, for talking to a computer. JavaScript is an example of a computer language. So is C, so is PHP, so is Python and so on.

A language on its own is just a set of grammatic rules and their meanings — nothing more that that.

A piece of software that is capable of understanding a piece of text written in a computer language is called an implementation of that language.

The implementation is free to use any methodology to bring the mere lines of text of the language to life by executing them in some way by the underlying machine.

Some common methodologies are compiling the program into native machine code, as happens with C and C++; interpreting the file in the old-school way reading each statement sequentially and executing it; or a more hybrid approach bringing the best of both these things into the equation, often called JIT compilation, as happens with JavaScript in the V8 engine and with PHP in the Zend Engine.

There might be, and usually are, numerous implementations of a language. Theoretically, a language's implementation could even be written entirely in the language itself and many already have been!

Back in the day, JavaScript was purely interpreted. However, nowadays, this is not the case for most engines. Instead, they use a hybrid approach that mixes together interpretation with compilation.

For us, we just need to know one thing which is that when we make any changes to a JavaScript program, we can go on and immediately run the program, and not have to compile it to a machine code executable and then execute it.

Moving on, like most languages used today, JavaScript supports more than one programming paradigm i.e. the style in which programs are written. In particular, it supports the procedural, object-oriented and functional paradigms.

JavaScript is imperative by nature which means that source code describes how something is being done (by the different commands and statements used therein).

However, a declarative style can be achieved easily via its functional paradigm. In a declarative style, which is the opposite of the imperative style, source code describes what is being done — the 'how' portion is abstracted away from the programmer by the language.

If all these terms are completely new to you, don't get worried — you'll get to know about all of them throughout this course and your journey of programming.

Moving on, as for the grammar and syntax of JavaScript, it's mostly influenced by Java and C. Most of the structures provided by JavaScript resemble similar C-like structures. Hence, if you're coming from a Java or C background, you'll pick up the syntax of JavaScript very quickly.

Believe it.

Into the stats

JavaScript as of today is quite a mature language. There are numerous tools built around it that are frequently used in web development and other software development concerns.

There are quite a few high-level JavaScript frameworks for the frontend to ease in developing web applications. To name a few, we have:

  1. AngularJS, a framework built by Google to develop robust web applications.
  2. React, a framework built by Facebook to help in building user interfaces.
  3. Vue.js, a framework for building user interfaces, created by Evan You.

In addition to these frameworks, there exists a plethora of libraries to aid in performing complex tasks such as visualizing data, lazily loading media, polyfilling unsupported features across browsers, and so on and so forth.

By far, one of the most popular libraries of JavaScript has been jQuery. It was released in 2006 with one simple goal: to aid in accomplishing simple tasks that were otherwise cubersome in plain JavaScript, owing to the inconsistencies across browers and the nature of the involved interfaces.

In addition to this, we have other libraries/frameworks such as:

  1. D3.js for data visualization.
  2. anime.js for complex animations.
  3. Chart.js for creating graph and chart diagrams.
  4. Swiper for creating highly-interactive mobile touch sliders.
  5. Lozad.js for lazily loading resources.
  6. Modernizr for detecting and polyfilling features across browsers.
  7. MathJax for mathematical notation.
  8. Mocha for unit testing JavaScript code.

...and so on and so forth.

This is just a brief overview of the huge ecosystem of JavaScript at our dispense. If we add server-side frameworks and libraries into the equation as well, then it'll require a whole course on our side just to list and give a one-line description of each of the technologies!

Moving on, let's now talk about the salary of a JavaScript developer.

Can we really expect good figures here?

Surely YES!

JavaScript developers have real significance in today's diverse web. New web applications are being made almost everyday while the existing ones being improved.

It's such a lucrative programming language that even complete newbies can expect good income from their very first JavaScript job.

But what really is that good income, in numbers?

According to Indeed, the average JavaScript developer salary in the United States is approximately $100k. This is quite a remarkable figure. Similarly, according to PayScale, the average salary is close to $90k.

Furthermore, as mentioned on Talent.com, the average salary for an entry-level JavaScript job in the United States is around $90k while that of an experienced position goes as high as $150k.

Obviously, this all varies across different countries, cities, salary surveys, and most importantly, across different experience levels.

Nonetheless, if you're a JavaScript developer, you can for sure expect a pretty decent salary even if you are applying for your very first job in JavaScript!

Let's now talk about some surveys conducted before that help justify the popularity and potential of JavaScript.

According to the StackOverflow Developer Survey 2021, JavaScript was the most popular programming language with over 60% of the total votes. To suprise us, JavaScript has maintained this position consecutively in the survey for the ninth year!

Furthermore, as determined by the HackerRank 2020 Developer Skills Report, the best known language was JavaScript. In fact, it has maintained this position throughout the years 2018 - 2020!

These aren't some mere achievements; rather, they are an evidence for the widespread popularity of JavaScript across the entire developer community.

To boil it all down, JavaScript is a very good option for anyone — be it a beginner, a mid-level, or an experienced developer — to learn.

There is a mind-boggling ecosystem and scope of the language with staggering salary figures and jaw-dropping survey achievements that all together are evident of the fact that learning JavaScript is a fruitful idea that'll surely improve your portfolio and technological inventory.

What can JavaScript do?

JavaScript has received an overwhelming amount of new features over the decades since its initial release on the Netscape Navigator in 1995. Back then, many many things weren't even thought of in the realms of JavaScript, but today they are routinely done in it.

To be specific, let's list down some of the thousands of things that could be done using JavaScript. It's time to explore its real potential.

JavaScript can be used to:

  1. Add, update and remove HTML content dynamically.
  2. Add, update and remove CSS styles from specific elements or the whole document.
  3. Make web pages interactive by listening to events.
  4. Download resources as needed.
  5. Get dimensions of given elements.
  6. Validate and interact with form data.
  7. Work with timers.
  8. Process cookie information and even create cookies.
  9. Enable drag-and-drop behavior.
  10. Create highly-controlled animations.
  11. Store data locally via the HTML5 Storage API.
  12. Create real-time web socket communcation.
  13. Interact with the microphone and camera hardware.
  14. Create 2D or 3D games using WebGL and other low-level APIs.
  15. Asynchronously talk to a server.
  16. Perform multithreading via service workers.
  17. Paint graphics using the canvas API.
  18. Work with audio and video media.
  19. Collect analytic information.
  20. Create Single Page Applications, or SPAs for short, resembling native desktop applications.
  21. Work with binary data using array buffers.

But why JavaScript?

Before learning any new technology in the world of computing, the first question that comes to the mind of the learner is 'why should I learn this?'

Let's try answering this question for JavaScript.

No installations required

The best thing about learning JavaScript is that you don't have to carry out even a single installation on your side to set up its execution environment. All you need is a web browser installed on your operating system, that's it.

Popular language

JavaScript is undoubtedly amongst some of the world's most popular languages, as you have seen in the stats above. Every website uses it in some form or the other. It's the only programming language that can be used on the frontend.

Huge support already available

Owing to the fact that JavaScript is extremely popular, it has a huge community of developers to help you out in anything you can't understand. Name anything you are confused about in JavaScript and there is a 99.999% chance that it may have already been asked for and answered.

Developers are continuously developing pages, creating helpful tools, writing blog articles to increase the awareness and core understanding of the language.

Very easy to learn

As we said even earlier, JavaScript is not a difficult language to learn. It has a very simple syntax and abstracts away tons and tons of machine-level detail from the end developer.

It is surely huge, but not something that'll require a lot of effort to get into our minds, as opposed to languages such as C++ that do have some sort of direct correspondence with machines in their syntax.

Can open up new learning paths

Learning JavaScript means that you can try exploring out JavaScript frameworks such as AngularJS, React, Vue.js and some of the helpful libraries. These frameworks are built using JavaScript and knowing it could mean that you can better understand their functionality and logic.

Learning JavaScript also means that you could go on to learn other languages such as PHP, Python or even C. That's because by the point you start learning these languages, you would've already tasted the flavor of programming.

Knowing one language really helps in learning others, and JavaScript is a very good choice for the very first programming language of a newbie programmer.

From now onwards..

Now that we have covered some solid ground on the details of JavaScript, it's time to start exploring it.

Starting from the next chapter uptil the very end of this course, we will introduce to each and every single aspect of the language that'll ultimately make you capable enough to build any program whatsoever for the frontend and then even explore the server-side of web development.

In short, it'll be an amazing journey of learning!

The real question is: are you ready?