What is JavaScript?
#JavaScript, #LearnToCode, #CodingTips, #WebDevelopment, #Frontend, #Fullstack, #Programming, #CodeNewbie
In the three minute introduction, I'm going to answer four frequently asked questions about
JavaScript. What is JavaScript? What can you do with it? Where does JavaScript code run?
And what is the difference between JavaScript and ECMAScript? So let's start with the first
question. What is JavaScript? JavaScript is one of the most popular and widely used programming
languages in the world right now. It's growing faster than any other programming languages,
and big companies like Netflix, Walmart, and PayPal build entire applications around JavaScript.
And here's the average salary of a JavaScript developer in the United States. That is $72,000
a year. So it's a great opportunity to get a good job out of learning JavaScript. You can work as a
front-end developer, or a back-end developer, or a full-stack developer who knows both the front-end
and the back-end. Now the second question. What can you do with JavaScript? For a long time,
JavaScript was only used in browsers to build interactive web pages. Some developers refer to
JavaScript as a toy language. But those days are gone because of huge community support
and investments by large companies like Facebook and Google. These days you can build full-blown
web or mobile apps, as well as real-time networking applications like chats and video
streaming services, command line tools, or even games. Here's an example. The third question.
Where does JavaScript code run? JavaScript was originally designed to run only in browsers.
So every browser has what we call a JavaScript engine that can execute JavaScript code. For
example, the JavaScript engines in Firefox and Chrome are SpiderMonkey and V8. In 2009,
a very clever engineer called Ryan Dahl took the open-source JavaScript engine in Chrome and
embedded it inside a C++ program. He called that program Node. So Node is a C++ program that
includes Google's V8 JavaScript engine. Now with this, we can run JavaScript code outside of a
browser. So we can pass our JavaScript code to Node for execution. And this means with JavaScript,
we can build the backend for our web and mobile applications. So in a nutshell, JavaScript code
can be run inside of a browser or in Node. Browsers and Node provide a runtime environment
for our JavaScript code. And finally, the last question. What is the difference between JavaScript
and ECMAScript? Well, ECMAScript is just a specification. JavaScript is a programming
language that confirms to this specification. So we have this organization called ECMA,
which is responsible for defining standards. They take care of this ECMAScript specification.
The first version of ECMAScript was released in 1997. Then starting from 2015, ECMA has been
working on annual releases of a new specification. So in 2015, they released ECMAScript 2015,
which is also called ECMAScript version 6, or ES6 for short. This specification defined many
new features for JavaScript. Alright, enough theory, let's see JavaScript in action. So every browser
has a JavaScript engine, and we can easily write JavaScript code here without any additional tools.
Of course, this is not how we build real world applications, but this is just for a quick demo.
So open up Chrome, right click on an empty area, and go to inspect. Now this opens up Chrome
developer tools. Here, select the console tab. This is our JavaScript console, and we can write
any valid JavaScript code here. So type this, console.log, put a single code here,
and then hello world. Another single code to terminate, close the parenthesis, and add a
semicolon at the end. Now as you go through the course, you're going to understand exactly what
all this means. For now, don't worry about it. So now press enter, and you can see the hello world
message on the console. We can also write mathematical expressions here. For example, 2 plus 2,
we get 4. Or we can do something like this, alert, parenthesis, single code, yo. Enter, and here's
an alert. In the next lecture, I'm going to talk about setting up your development environment for
writing JavaScript code. Well, hello, it's Mosh here. Thank you for watching my JavaScript tutorial.
I just wanted to quickly let you know that this tutorial is part of my complete JavaScript course,
where you can learn about all the essential concepts in JavaScript. The course is packed
with lots of exercises and solutions, and by the end of watching the course, you will also receive
a certificate of completion. In case you're interested, you can find the link in the video
description, and if not, that's perfectly fine. Continue watching as the next section is coming up.

