Engineering Blog

                            

Blog – 4 Column

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,…

Using index as a key in React (anti-pattern)

What are lists in React ? Lists are used to display data which are similar in ordered format . Often they have same type i.e an array of similar kind of data rendered into a list tag using some version of for loop. How does react render lists? DOM Before we learn how react renders lists…

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…

Utility Types in TypeScript
Utility Types in TypeScript

What are utility Types? In TypeScript, utility types are built-in types that allow you to manipulate and transform existing types. They can be used to extract, exclude, or modify the properties of an existing type, or to create a new type based on an existing one. TypeScript provides several utility types to facilitate common type…

Using defer inside a loop
Using defer inside a loop

The defer keyword allows a function call to be postponed until the surrounding function has completed execution. This can be useful for reducing redundancy in code, such as when a resource needs to be closed after use. However, it’s important to be mindful of using defer within a loop, as it can have unintended consequences…

Thinking concurrency is always faster

Many developers mistakenly believe that a concurrent solution will always be faster than a sequential one, but this is not always the case. The performance of a solution depends on various factors, such as the efficiency of the concurrency structure, the parts that can be processed in parallel, and the level of contention among the…

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…

Stripe Payment with Golang
Stripe Payment with Golang

In this blog post, I will discussed on the topic of stripe payment integration with Golang. Before that i will give brief introduction about this and move head to simple implementation. It is a famous payment gateway that helps in financial transaction between merchants and customers. It accepts 133+ countries currency. It is a powerful…

Common Anti-patterns with React
Common Anti-patterns with React

Nested components When a component is defined inside another component, it creates a tight coupling between the two components, meaning that they are highly dependent on one another. This can make it difficult to reuse or re purpose the inner component. Also when the parent component re-renders , the inner component will be defined again…

Not properly checking if a slice is empty

In the previous blog post we discussed about distinction between nil and empty slices. We have to clear about some notation, what is the idiomatic way to check if a slice contains elements? Not having clear answer can lead to subtle bugs. Let’s talk about the example, we call a getAmounts() function which returns a slice…