Getting Started With JavaScript.

Getting Started With JavaScript.

ยท

3 min read

JavaScript is one of the most popular programming languages. JavaScript allows us to add dynamic content to our web pages, and it allows us to make our web pages more interactive eg. You must have used dropdown menus, alerts, and other dynamic content on the web pages, it might be possible that they all are achieved using JavaScript. It has been the most popular programming language for more than 5 to 6 years in a row.

Why JavaScript?

As I have already mentioned that JavaScript is one of the most popular programming languages. In today's internet, almost more than 90% of website uses JavaScript, so there are always requirements for JavaScript Developers. In the early days, JavaScript was used on the client-side only but with help of runtime environments like node we can now run JavaScript also on the server-side.

  • client-side:code is downloaded as plain text and is executed on the user's computer only.

  • server-side: code is executed on the server, and only results are downloaded and displayed on the screen.

Now JavaScript has evolved so much that with help of JavaScript only you can develop webpages, Single Page Applications, mobile apps, desktop apps, backend applications, Game development and even now you can do machine learning with JavaScript, you can say that possibilities are endless.

A pinch of history.

During the browser war between Microsoft (Internet Explorer) and Netscape (Netscape Navigator). In 1995 Netscape's engineer named Brendan Eich developed a new lightweight scripting language called Mocha , and later it was renamed to JavaScript. Soon after that in 1996 Microsoft also developed its own version of JavaScript and this brought compatibility issues to the website. To develop JavaScript, Netscape and Brendan Eich took it to the ECMA international standards organization in 1996. In 1997 the language specification called ECMAScript as a ECMA-262 standard was published. This specification could be used by other browser vendors to prepare their implementations.

Getting Started

Now, let's get started and write our first program in JavaScript, but where, we can run JavaScript directly in the browser console but we are not going to do that. For executing the JavaScript code we are going to use nodejs which is a runtime environment based on the chrome v8 engine, we will learn about the runtime environment and engine later and for writing the codes we are going to use vs code. Download these tools from their official website and install them in your system.

Hello World

Create a directory and open that directory in vs code, and create a new file in that directory hello.js notice the .js extension all JavaScript code files have .js extension. Write the following line in that file.

console.log("Hello World!"); 
// console.log is used to dislplay message in the console

Open vs code inbuilt terminal by pressing cltl + ` together, and writenode hello.js and press enter. This will display Hello World! message in your terminal. That's it we have written our first program in JavaScript. In the next article, we are going to learn about the values we can use in JavaScript.

Did you find this article valuable?

Support Ankit Kumar by becoming a sponsor. Any amount is appreciated!