This post was originally published on my blog, find original post here
Lets see what is Javascript, what we can achieve with it and
limitations of Javascript.
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 ☕ 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
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 | Chrome and Opera |
SpiderMonkey | FireFox |
ChakraCore | MicroSoft Edge |
SpiderMonkey is the first JavaScript engine, written by Brendan Eich (creator of the JavaScript)
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
Javascript has full integration with HTML/CSS, but Javascript on a webpage doesnot have access to files in the hard disk.
Top comments (0)