Engineering Blog

                            
Suresh Thapa

Suresh Thapa

Software Engineer
Misunderstanding variable scope in JavaScript

Misunderstanding variable scope in JavaScript

In this post, we are going to understand variable scope and difference between var, let and const keywords in javascript. Variable scope is tricky concept for new developers., especially in javascript. Most of beginner developers make common mistake like defining the variable inside the function and expecting it to access outside the function. Understanding var,…

Object references and copying

One of the fundamental differences of objects versus primitives is that objects are stored and copied “by reference”, whereas primitive values: strings, numbers, booleans, etc – are always copied “as a whole value”. That’s easy to understand if we look a bit under the hood of what happens when we copy a value. Let’s start…

Introducing constructors

Introducing constructors

If we need to create multiple object of same shape then one of the way to define the shape of is by using the function. we have to create an empty object, initialize it, and return it. A better way is to use a constructor. A constructor is just a function called using the new keyword. When…

Scheduling: setTimeout and setInterval

We may decide to execute a function not right now, but at a certain time later. That’s called “scheduling a call”. There are two methods for it: These methods are not a part of JavaScript specification. But most environments have the internal scheduler and provide these methods. In particular, they are supported in all browsers…

Function in JavaScript

Function in JavaScript

A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. We can separate function in…