Overview
JavaScript is a programming language that was created by Brendan Eich in 1995 for adding interactivity to web pages. Initially it was called LiveScript, but later it was renamed to JavaScript.
It runs in the browser and on the server. JavaScript is a dynamic, weakly typed, and interpreted programming language. It is a multi-paradigm language, which means that it supports different programming styles like object-oriented, functional, and imperative programming.
Before jumping to the next thing about JS, let's see what programming language is
Programming Language
A programming language is a set of rules, symbols, and syntax that is used to communicate instructions to a computer. It is a way for humans to write programs that the computer can execute. There are many programming languages, each with its own set of rules and syntax. Some examples of programming languages include:
Language | Creator | Year |
---|---|---|
C | Dennis Ritchie | 1972 |
C++ | Bjarne Stroustrup | 1983 |
Java | James Gosling | 1995 |
Python | Guido van Rossum | 1991 |
JavaScript | Brendan Eich | 1995 |
PHP | Rasmus Lerdorf | 1995 |
Ruby | Yukihiro Matsumoto | 1995 |
C# | Microsoft | 2000 |
Scala | Martin Odersky | 2003 |
Go | 2009 | |
Rust | Mozilla | 2010 |
Dart | 2011 | |
Kotlin | JetBrains | 2011 |
TypeScript | Microsoft | 2012 |
Swift | Chris Lattner and Apple | 2014 |
Uses of JavaScript
JavaScript is a programming language that is commonly used in software development in several contexts. Here are some examples of how JavaScript is used in different areas of software development like frontend, backend, mobile, desktop, game development, etc.
History and evolution of JavaScript
JavaScript is a programming language that was created by Brendan Eich in 1995 for adding interactivity to web pages. Initially it was called LiveScript, but later it was renamed to JavaScript. ECMAScript (shortly ES) is the official name of the JavaScript standard. It is maintained by the European Computer Manufacturers Association (ECMA) and is the standard that all JavaScript engines must follow.
JavaScript has undergone several versions over the years. The most widely used versions are:
- ES1 - also known as ECMAScript 1, released in 1997
- ES2 - 1998
- ES3 - 1999
- ES5 - 2009
- ES6 - 2015
- ES7 - 2016
- ES8 - 2017
- ES9 - 2018
- ES10 - 2019
- ES11 - 2020
- ES12 - 2021
Let's see them in details.
ES1 - 1997
Introduced the basic syntax of the language, including variables, operators, and control statements.
ES2 - 1998
Introduced the with
statement, which allows you to create a new scope for a block of code. It also introduced the for-in
loop, which allows you to iterate over the properties of an object.
ES3 - 1999
Introduced regular expressions, better string handling, new control statements, and try-catch exception handling. It also improved the handling of errors and introduced the strict mode, which helps to prevent some common JavaScript errors.
ES5 - 2009
Made improvements to the language such as better support for arrays, new methods for working with strings and objects, and the ability to create more efficient code using strict mode. It also introduced new methods to help prevent and fix common coding mistakes.
ES6 - 2015
ES6 is a significant update to the language, introducing many new features and improvements. Some notable features include:
-
let
andconst
for variable declarations - to declare variables that are block-scoped - arrow functions - a shorter syntax for writing functions i.e.
const add = (a, b) => a + b
- template literals - backticks (``) for string interpolation and multi-line strings
- classes and inheritance - a way to create objects and classes
- destructuring assignment - to unpack values from arrays and objects into distinct variables
- default function parameters - to set default values for function parameters
-
Promises
for handling asynchronous code - a more readable way to handle asynchronous code - and many more improvements and additions to the language
ES7 - 2016
ES7 introduced several new features, including:
-
Array.prototype.includes()
- method to check if an array contains a value or not i.e.array.includes(value)
returnstrue
if the array contains the value, andfalse
if it does not - Exponentiation operator (
**
) - to calculate the power of a number (e.g.2 ** 3
is8
) - and
async
/await
- another way to handle asynchronous code - and many more improvements and additions to the language
ES8 - 2017
It includes:
-
Object.values()
andObject.entries()
- methods to get the values and entries of an object as an array (e.g.Object.values({ name: 'John', age: 30 })
returns['John', 30]
) - String padding - to add padding to a string using the
padStart()
andpadEnd()
methods (e.g.'hello'.padStart(10)
returns' hello'
) -
Object.getOwnPropertyDescriptors()
- method to get the descriptors of an object -
async
functions - asynchronous functions that return aPromise
and can use theawait
keyword - and more improvements and additions to the language
ES9 - 2018
It introduced:
- Asynchronous iteration - to iterate over asynchronous data i.e.
for await (const value of asyncIterable) { ... }
- rest/spread properties for objects - to copy objects and merge objects using the spread operator (
...
) i.e.{ ...obj1, ...obj2 }
-
promise.finally()
- to execute code after aPromise
is settled (either fulfilled or rejected) - template literals improvements - to use raw strings and to tag template literals
- and many others
ES10 - 2019
It included:
-
Array.flat()
andArray.flatMap()
- to flatten arrays and to flatten arrays and map them at the same time -
Object.fromEntries()
- to convert an array of key-value pairs into an object i.e.Object.fromEntries([['foo', 1], ['bar', 2]])
//{foo: 1, bar: 2}
-
String.trimStart()
andString.trimEnd()
- to trim whitespace from the beginning and end of a string - and others
ES11 - 2020
It introduced:
- Dynamic
import()
- to import modules dynamically (i.e. at runtime) - globalThis - to get the global object i.e.
globalThis
is the same aswindow
in the browser andglobal
in Node.js - Nullish coalescing operator (
??
) - to return the right-hand side operand when the left-hand side operand isnull
orundefined
-
BigInt
- to represent integers larger than 2^53 - 1 which is the largest number JavaScript can reliably represent with the Number primitive and represented by the Number.MAX_SAFE_INTEGER constant - and others
ES12 - 2021
It includes:
- Logical assignment operators - to assign values to variables based on a condition (e.g.
x ||= y
is the same asx = x || y
) - Optional chaining operator (
?.
) - to access properties of nested objects without having to check if the parent object exists or not - Nullish coalescing operator (
??
) - to return the right-hand side operand when the left-hand side operand isnull
orundefined
- String.prototype.matchAll() - to get all matches of a regular expression in a string as an iterator of
RegExpMatchArray
objects (i.e.string.matchAll(/foo/g)
) - JSON superset - to allow trailing commas in JSON objects and arrays and to allow single quotes in JSON strings (i.e.
{"foo": "bar",}
and{"foo": 'bar'}
are valid JSON) - and others
It's worth noting that not all browsers or JavaScript engines support the latest version of ECMAScript, so it's important to keep that in mind when developing applications that need to run on multiple platforms, because some features may not be supported on all browsers, like Internet Explorer.
Top comments (0)