Proud to present in East India Largest Tech Conference TechBhubaneswar

I will start with TechBhubaneswar is one of the best-organized conference. Disciplined volunteers, visionary core team members, and electrifying audiences. It was surely a gala gathering of more than 500 techie in beautiful city of Bhubaneswar. I am humbled that I was invited as speaker. I had proud moment representing Infragistics in esteem conference and teaching some JavaScript to 250 developers.

You can watch my talk here:

 

On 10 December 2017, I had an opportunity to give a talk in East India Largest Developer Conference, TechBhubnaeswar. I presented on “JavaScript Objects and Prototypes”.

clip_image002

About the conference

TechBhubaneswar is East India largest tech conference, which brings together minds that are excited about headways, expansions and possibilities in the field of Software Industry. The event is hosted by Mindfire solution to inspire young techie minds to imagine and pursue. This was their second edition, and in a single day conference comprise of 12 sessions in 3 tracks and 1 panel discussion.

clip_image004

It was one of the best-organized conference attended by me. Each volunteer and members were highly motivated to deliver best experience to both speakers and attendees. I admire vison of Mindfire solution to bring esteem speakers to this part of India and nurture great tech eco system. Congrats to them for their awesome work.

About my talk

My talk was just after respected Shivprasad Koirala. He gave a very informative talk on Design Patterns in C#. I was bit nervous that how audience would take my session on JavaScript Objects and Prototypes.

clip_image006

As JavaScript prototypes are always confused for all of us, so I had a tricky task ahead of me to simplify this topic to 250 audiences. I had to use white board in a conference to simplify prototypes and __proto__ to developers.

I divided my one-hour talk in four section and did four major demos to teach these topics. I logically divided talk in four parts as,

clip_image008

I have written extensively about these topics on Infragistics blog here feel free to refer them. It was one of the best audience, I have ever presented too.

clip_image010

At the end, I found happy faces and it was good. Positive energy of each single audience motivated me and I thank them for bottom of heart.

clip_image012

You can watch talk here:

Once again, I thank TechBhubaneswar team for this opportunity and I look forward for next year conference.

Class in JavaScript

Read full article on the Infragistics blog

ECMAScript 6 introduced the class keyword to create classes in JavaScript. Now, you can just use the class attribute to create a class in JavaScript. Before ECMA 6, whenever you called a function using a new operator, the function returned a new object. Therefore, the function was acting as a class and known as a constructor. This way of calling a function to return an object is also known as the Constructor Invocation Pattern.

But In ECMAScript 6, a class can be created using the class keyword. Consider the code below:

In the above code snippet, you have created a class named Car using the ECMAScript 6 classkeyword. You can also create an object of the Car class as shown below:

The JavaScript class is a simplified syntax for the usual prototype based inheritance. It does not offer any new way of object creation or prototype inheritance and does not bring any new models of object orientation or inheritance in JavaScript. You could say that a class is a special function to create objects.

Read full article on the Infragistics blog

Simplifying function expressions and the function statement in JavaScript

Read full article on the Infragistics blog

In JavaScript, a function can be created in three possible ways:

  1. Function as an expression
  2. Function as a statement
  3. Arrow functions

In this post, we will learn about function expressions and the function statement.

Consider the following code:

When you create a function as shown above, it is called a function declaration or statement. You can rewrite the code above to add a function in different ways, as shown below:

The function created above is called a function expression – in this case, an anonymous function expression. A named function expression can be created as below:

The name of the function expression can only be used inside a function body, which is helpful in recursion. A function expression can either be a:

  1. Named function expression
  2. Anonymous function expression

The third method of creating a function is by using the Arrow function, which was introduced in ECMAScript 6. You can learn more about Arrow functions here.

Read full article on the Infragistics blog

What are the Call and Apply Methods in JavaScript

Read full article on the Infragistics blog

In JavaScript, the apply() and call() methods execute a function in the context (scope) of the first argument you pass to them. Let’s take a look at them in action to learn more. Say that you have an object person as shown below:

And in addition, you have a function message as shown below:

Now, you have a requirement to pass the person object as the value of this in the function. In addition to explicitly passing the value of this, you also need to pass the value for the age parameter.

You can pass the context (the value of this) explicitly using by either the call() or apply() methods. Consider the following code:

Using the call method, we are passing the object person as the value of this inside message function.  You can achieve the same using the apply() method as shown in the listing below:

In JavaScript, the call() and apply() methods work in almost exactly the same way, but with a few key differences:

  1. The first parameter of both call() and apply() is the value of this object.
  2. In the call() method, the other arguments to function will be passed as separate comma separated values.
  3. The call() method takes zero or more individual parameters.
  4. In the apply() method, the second parameter is an array.
  5. The apply() method takes an array of parameter.
  6. You should use the call() method when the number of function parameters is fixed.
  7. You should use the apply() method, when the number of function parameters is not fixed.

 

Read full article on the Infragistics blog

Four Ways to Create Objects in JavaScript

In JavaScript, there are four methods to use to create an object:

  1. Object literals
  2. New operator or constructor
  3. Object.create method
  4. Class

In this post, we will learn each of these methods.

Object literals

An object literal, also called an object initializer, is a comma-separated set of paired names and values. You can create an object literal as shown below:

You can add properties dynamically in an object, including after you have created the object. Here we add the dynamic property car.type:

The object literal is a simple expression that creates an object each time the statement that it appears in is executed in the code. You can also use Object.defineProperty to create properties in the object literal as shown below:

The main advantage of using Object.defineProperty is that you can set values for object property descriptors or modify existing properties. You can learn more about Object Property Descriptor here.

New Operator or Constructor

The second way to create an object is to use the constructor function. If you call a function using a new operator, the function acts as a constructor and returns an object. Consider the following code:

Learn full article on the Infragistics blog