AN INTRODUCTION TO JAVASCRIPT
Tags: javascript
Published: 2019-02-14 13:00:51

---
title: AN INTRODUCTION TO JAVASCRIPT
published: true
description: Lets see what is Javascript, what we can achieve with it and limitation of Javascript
tags: JavaScript
---

This post was originally published on my blog, find original post [here](https://santhoshkumarr0.github.io/posts/an-introduction-to-javascript/)

Lets see what is Javascript, what we can achieve with it and 
limitations of Javascript.

![JavaScript](https://msatechnosoft.in/blog/wp-content/uploads/2017/04/JavaScript-in-web-design-Basics-Advantages-Limitations-Form-Validation-MSA-Technosoft.png)


## What is JavaScript ?
JavaScript is one of the most popular programming languages in the world.
Being the first and the only scripting language that was supported  natively by web browsers, it simply stuck

> Javascript makes web pages alive

Before Javascript, every website provides static content which does not make webpages appear alive.
Javascript allows to implement complex things like displaying time, validate the web form, interactive maps, 2D/3D graphics.

Javascript is a scripting language, so scripts are executed as plain text.
They don't need to be compiled to execute.They can be written in webpage and executed when web browser loads the web page.

> [Java](https://en.wikipedia.org/wiki/Java_%28programming_language%29) :coffee: nd Javascript are very different programming languages.


JavaScript was originally named Mocha, later it was renamed to LiveScript, and then to JavaScript. When Javascript was created, Java was very popular at that time, so they decided that renaming it as Javascript would help it.

## JavaScript engine

![V8](https://proxy.duckduckgo.com/iu/?u=http%3A%2F%2Fi1-news.softpedia-static.com%2Fimages%2Fnews-700%2FChrome-May-Add-Support-for-Mozilla-s-Asm-js-the-Native-Client-Competitor.png&f=1)

Javascript engine is virtual machine which executes Javascript in the browser.
Javascript can run on any device which has Javascript engine. Javascript converts the script to the machine language. Machine code runs pretty fast.

Each browser has its own Javascript engine

Javascript engine | Browser
-------------|--------------
[V8](https://v8.dev/) | Chrome and Opera
[SpiderMonkey](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey)| FireFox
[ChakraCore](https://en.wikipedia.org/wiki/Chakra_(JavaScript_engine)) | MicroSoft Edge

SpiderMonkey is the first JavaScript engine, written by [Brendan Eich](https://en.wikipedia.org/wiki/Brendan_Eich) (creator of the JavaScript)

[Node.js](https://en.wikipedia.org/wiki/Node.js) is a JavaScript runtime environment built on Chrome's V8 JavaScript engine. Node.js executes JavaScript code in server-side.

## What can JavaScript do ?

Javascript is well-suited for performing task in the browser. It is primarily used to interact with users.

 - It can change existing HTML content,modify HTML styles, HTML attributes.
 - It can validate input forms.
 - React to user actions like mouse clicks, key presses
 - Perform the calculation.
 - send requests to server, get the  data (AJAX)
 - get and set cookies in the browser
 - store the data in browser local storage 

Javascript's capabilities depends on the its environment. Nodejs allows Javascript to access file system, access network and call [system call](https://en.wikipedia.org/wiki/System_call)

Javascript has full integration with HTML/CSS, but Javascript on a webpage doesnot have access to files in the hard disk.