9 November 2024

JavaScript Basics

coding
What is the right path?

T
Written by

thatonevikash

JavaScript

JavaScript: The dynamic language of the web.

JavaScript is a programming language that brings web pages to life. It's the core technology of the web, working alongside HTML and CSS. While HTML structures the content and CSS styles it. JavaScript adds interactivity and dynamic behaviour.


What can we do with JavaScript ?

Key characterstics of JavaScript

History of JavaScript

Birth of JavaScript

Early years and Browser's war

Growth and Maturity

Modern JavaScript

Creation of server-side JavaScript

While JavaScript initially designed for the client-side, its versatility and popularity led to its expansion into server-side development.

Early attempts

The rise of Node.js

Impact of Node.js

Beyond Node.js

You have to know!

What is the difference between a normal text file and a source code file ?

Lets create a file as test.js

console.log("vikash");

Inside the test.js file we have console.log("vikash") and each word has specific task or meaning on the programming. console does a specific task when the source code executed on the software.

Lets create another file as test.txt

console.log("vikash")

But the main thing, which file can be executed, when we inject them into a software ( compiler/interpreter ). This software has a task to identify the extension of file and perform actions according to the written source code.

Every programming language has a syntax to write their source code and every programming language comes with their extension. eg. .js, .java, .cpp, .py and so on..

Old style vs New style of learning JavaScript

In early days, People runs script using a HTML file. They just simply create an index.html file and inside it they start a <script> tag for writing Javascript.

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Document</title>
  </head>
  <body>
    <script>
      console.log("Hello world!");
    </script>
  </body>
</html>

and executes the HTML file on the browser. Because JavaScript is hidden inside for a long time in the browser.

But in the recent past It emerged from the browser by Ryan Dahl.

Nowadays, we can execute our JavaScript code standalone like python, java, c++ code.

Lets talk about PC configuration and Softwares to run JavaScript

For running JavaScript, There is no any higher requirement. We can run our code directly on the browser.

  1. Directly on browser's console

  2. Install a runtime for JavaScript like node.js Once you download and installing, confirm it.

    node -v
    
  3. Install a code editor ( IDE ) like vs code VS code is an IDE ( Integrated Development Environment ) provides multiple features like auto indentation, code suggestion, Extension supports, File tracking using git and GitHub, Integrated Terminal.

Run your first JavaScript file

Create a directory where you want to store your JavaScript file, open it in vs code.

Lets create a file as test.js and write some code

// test.js

console.log("hello world!");

Now look on the top of the vs code you will find Terminal, create a new terminal and execute the source file

node test.js

Written with 💖 by thatonevikash!