JavaScript
Introduction
JavaScript is the world's most popular programming language of the Web and it is easy to learn.
By default, it run using a single thread. Though there are ways to create new threads. but it is considered as single threaded language.
JavaScript does not wait for I/O operations to get completed, instead it continues the execution of the program. This is called as non-blocking I/O.
JavaScript is asynchronous because of the NIO nature.
JavaScript enables interactive web pages and is an essential part of web applications.
It has application programming interfaces (APIs) for working with the text, dates, regular expressions, standard data structures and the Document Object Model (DOM).
JavaScript engines were originally used only in web browsers, but they are now core components of other runtime systems, such as Node.js and Deno. These systems are use to build servers and are also integrated into frameworks, such as Electron and Cordova, for creating a verity of applications.
It is dynamically typed. It determines variables types, ordering etc. in runtime.
Frameworks
- Angular
- React
- Vue.js
- Ember.js
- Meteor
- Mithril
- Node.js
Features
- Light Weight Scripting language.
- Dynamic Typing.
- object-oriented programming support.
- Functional Style.
- platform Independent.
- Prototype-based.
- Interpreted Language.
- Async Processing.
- Client-Side Validation.
- More control in Browser.
We can use,
- innerHTML
- document.write()
- window.alert()
- console.log()
To display the data.
Syntax
JavaScript syntax defines two types of values.
- Fixed values
- Variable values
Fixed values are called Literals.
Variable values are called Variables.
Literals
Numbers are written with or without decimals.
ex: 10.50, 10
Strings are text, written with double or single quotes.
ex: "welcome", 'welcome'
Variables
In a programming language, variables are used to store data values.
JavaScript uses the var keyword to declare variables.
An equal sign is used to assign values to variables.
ex:
var x;
x = 6;
Variables
we can use // is to comment single line and /* */ is to comment multi line.
All JavaScript identifiers are case sensitive.
Hyphens are not allowed in JavaScript. They are reserved for subtraction.
We can use Underscore, Upper Camel Case (Pascal case), Lower Camel Case to declare the variables.
Versions
JavaScript was invented by Brendan Eich in 1995, and became an ECMA standard in 1997.
ECMAScript is the official name of the language.
ECMAScript versions have been abbreviated to ES1, ES2, ES3, ES5 and ES6.
Since 2016 new versions are named by the year (ECMAScript 2016/ 2017/ 2018).
Comments
Post a Comment