Hello Everyone ,
This is my first blog on medium. In this blog we will discuss about EcmaScript standard.
ES5 and the ES6 (also known as EcmaScript 2009 & 2015) are the most popular and widely used standard for JS. In this blog we will discuss these two standards broadly. First Let’s discuss about ES5 :
ES5 : ES5 was first released in 2009 , 10 years after the previous version was released. ES5 had 5 main differences from ES3 :
- Strict Mode : In ES3 failure is silent i.e execution will happen assuming everything got successful. Programmers can’t check after every assignment to check if it was successful.
In ES5 failure assignment throw. Using Strict mode you can’t use unused variables. It helps writing clean and error-free code.
To enable this feature you just need to write “use strict” at the top of your js file.
2. function : The function in ES5 has 4 features :
a. the value of this will not be changed when calling .call() or .apply()
b. null and undefined will not be returned to global
c. a non-object will not be switched to an object
d. new method .bind() is introduced . the bind() method allows user to bind the value of this and apply the value to the function . Let’s understand with an example.
3. Array : ES5 introduced a lot of new built-in array methods .
They are :
JSON : ES5 introduced two new methods to translate JSON data .
a. JSON.stringyfy() : This method takes a valid JOSN object as an argument and returns the string version of it.
b. JOSN.parse() : This method takes a string literal and converts it into a valid JSON.
5. Properties and attribute :
ES3 code can only create properties that are writable ,enumerable and deletable.
ES5 introduced properties as writable , enumerable ,configurable and controllable.
Attribute values are programmatically settable and testable. Also accessor properties i.e getter and setter was added.
With this I am ending the first part of the Blog . Soon I will be publishing the last part explaining ES6.
Stay tuned :)