Understanding the ECMA Script specification

Posted By :Pawan Singh Nagarkoti |23rd July 2022

ECMA SCRIPT

 

Javascript is a programming language for the web. There are numerous frameworks and libraries for javascript. Javascript is used in web development for both the front and back ends. A cross-platform JavaScript runtime environment is Node.js. The backend is node js.

 

European Computer Manufacturers Association is what ECMA Script stands for. The scripting language on which JavaScript is built is called ECMAScript. Additionally, it works with node js. A framework or library is not what an ECMA script is.

 

History and version of the script.

 

1. It First appeared in 1997, 23 years ago.

2. First edition in June 1997.

3. ES6 (6th edition) in 2015 also called ECMA Script 2015.

 

Feature in ES6.

1. let and const.

2 Arrow Functions

3. Multi-line Strings

4. Default Parameters

5. Template Literals

6. Destructuring Assignment

7. Template Literals

8. Promises

9. Classes

10. Modules

11. Default Parameters.

12. Find and findIndex

13. rest parameters

 

let and const Keywords.

let and const keywords are used when declaring a variable in javascript. let and const have to block scope when declaring a variable through the const keyword its value is constant and can not change. when declaring a variable with a let keyword can not be Redeclared, its scope has block scope. 

let a = 10;

const  b = 'oodles'

 

Default Parameters.

It is used in functions when we do not assign any parameters, 

 

for example. 

function test(a,b=1){

    return a+b;

}

console.warn(add(10))

 

Template Literals

it is also known as string template literals. It is used to concrete a string.

 

example.

let a = 'test 1'

let b = 'test2'

console.log(`First value of of ${a} and second value of ${b}`);

 

Find and findIndex

find method is to return the first value of an array and object. it returns undefined when the condition is not matched.

let data = [1,2,3,4]

let result = data.find(()=>{

    return item<3;

})

console.log(result);

 

The findIndex method returns the index of the first element. it returns -1 when the condition is not matched.

let arr = [1,2,3,4]

let result = arr.findIndex(()=>{

    return item<3;

})

console.log(result);

 

Arrow Function

Arrow functions were introduced in ES6.  it allows writing a function in a short method.

const a  = ()=>{

    console. log(10)

}

console.log(a);

If the function has only one statement, and the statement returns a value, you can remove the brackets and the return keyword, this statement only work if the function has only one statement.

a = () => console.log (1)

this keyword is not worked inside the arrow function.

 

Classes

Classes in javascript are built on prototypes. the class keyword we used to create a class. created a class method syntax similar to the object in javascript. class is introduced in es6. inheritance is also supported in classes.Classes are a unique type of function in JavaScript.

 

class Fruits{

            name="orange"

            constructor()

            {

                console. warn("constructor", this. name)

            }

             getFruits(item)

            {

                return item

            }

        }

        let f1= new Fruits;

        console.warn(f1.name)

 

 

Rest parameters

With the help of rest parameters, we efficiently handled parameters in a function. We often used rest parameters when we don't know how many arguments are passed.

       function fruits(a,...z)

       {

           console.warn("fruits",z)

       }

       function test()

       {

       }

       fruits('apple', 'banana', 'kiwi', 'orange', 'papaya', test);

 


About Author

Pawan Singh Nagarkoti

Pawan is a highly skilled Frontend Developer with extensive experience in the industry. He stays up-to-date with the latest technologies, including Angular, JavaScript, React JS, HTML5, and CSS3. He has contributed to a diverse range of projects, including Konfer, KRB and Microsite (chatbot and ChatGPT). He consistently strives for excellence and delivers exceptional results in his work. He is passionate about exploring the internet and staying informed about the latest advancements in the ever-evolving world of technology. Pawan's commitment to continuous learning enables him to stay at the forefront of his field and deliver innovative solutions to his clients.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us