avatar

Gagandeep Singh

Feature flagging in webpack

Agile methodologies allows for smaller release to production fairly quickly. This could result in more feature branches/pull requests being created to enable/disable some feature specially when something needs to be tested on production. Other main advantage to use feature flag is that we don’t need to wait for a feature to be completed before it could be deployed to production. The feature flag for that particular feature could be switched off and once the whole feature is completed, tested and deployed to production, the feature flag can again be turned on.

Various loops available in javascript

This post will focus on the various loops available in the javascript and when to use them. for - Probably the most commonly used loop in any programming language. The for loop runs until a specific condition is true. As seen below, it has 3 parts: i) initialization (i=0) ii) condition (i<5) iii) increment/decrement (i++/i--) for (let i = 0; i < 5; i++) { console.log(i); } for (let i = 5; i >= 0; i--) { console.

useCallback vs useMemo

useCallback and useMemo are two of the multiple hooks released with React V16. Hooks are javascript functions which help in isolating some functionality from the functional component (hooks cannot be used inside class based components). useCallback - As per the official documents, useCallback “Returns a memoized callback”. Here memoized means maintaining or saving a version of the function in the memory for the given array of one or more dependencies.

Different console methods in Javascript

There are few console methods available in Javascript, console.log being the most common one. Each of these variations of console methods could and should be used depending on type of data to output. console.log() - As mentioned earlier console.log() is the most common console method and can be used to output any kind of data. console.log(); const message = "Hello world"; const num1 = 10; const num2 = 20; console.

Structs in Go

Struct in Go allows to create custom data types. In the example below User is a struct type, it’s defined using the type keyword followed by the struct name and then struct. Struct can have once or more fields in it and fields are defined using name and type. For example: package main import "fmt" func main() { type User struct { firstname, lastname string age int } u1 := User{ firstname: "Gagandeep", lastname: "Singh", age: 32} fmt.