Sometimes we implement multiple external links which points to the same resource. For example in one of our websites we have

Both of these result to

Thus the website made 3 network requests for the same resource 😅😅

The solution?

I observed that implementing the final result i.e.

reduced the number of network calls from 3 to 1 ✌

Read more:

It changes

p { padding-top: 10px;
padding-right: 20px;
padding-bottom: 30px;
padding-left: 40px; }


p{padding:10px 20px 30px 40px}

Changes colors (e.g. #336699) to it’s shorter forms.

p { margin-top: 10px;
margin-right: 20px;
margin-bottom: 30px;
margin-left: 40px; }


p{margin:10px 20px 30px 40px}

and many more.

The playground is here:



Read more:

When JavaScript evaluates 0 && anything the result will always be 0 because 0 is falsy, so it doesn’t evaluate the right side of the &&

console.log(0 && true) // 0 - falsy, right side not evaluated
console.log(0 && false) // 0 - falsy, right side not evaluated
console.log(false && true) // falsy, right side not evaluated
console.log(false && false) // falsy, right side not evaluated

Look at these too:

console.log(1 && true) // true, right side evaluated
console.log(1 && false) // false, right side evaluated
console.log(1 && false) // false, right side evaluated
console.log(1 && false) // false, right side evaluated

The solution? Use a ternary to be explicit.

Read more:

Sometimes we need to check the existence/truthiness of properties on objects/classes. For example, this is how we generally write it:

if (family && family.mother && family.mother.child){

This can be written in short like this:


The magical operator being used here i.e. ?. is called the Optional chaining operator.

Read more:

Shorten code for decimal numbers using exponential notation instead of 0s

In javascript, N number of 0s after a number can be replaced with eN


5e4 = 50000

7e2 = 700

7e0 = 7

7e1 = 70

Read more:

For loops can be shortened and cleaned. Let’s see an example:


const friends = ['amar', 'akbar', 'anthony'];for (let i = 0; i < friends.length; i++){    console.log(friends[i]);}

Short / clean form:

const friends = ['amar', 'akbar', 'anthony'];for (const friend in friends){    console.log(friend);}

Read more:

Check for synchronous code in Nodejs process:

The command-line utility --trace-sync-io tells us about synchronous tasks.

Example use:

node --trace-sync-io index.js

Read more:

Sometimes we need to assign only truthy (not undefined/null/empty) values to our variables.

It is done like this:

if (myVar !== null && myVar !== 'undefined' && myVar !== '') {
yourVar = myVar;
else {
yourVar = 'new default value';

This can be optimized as:

yourVar = myVar || 'new default value';

Read more:

A. Provide constructive criticism for code improvement to team members

B. Try to get everyone to give PR comments (or at least have a look at other’s code changes) irrespective of anything

C. Learn from others code

D. Teach better coding practices with your PR comments

E. If needed, decline PR request in worst-case scenarios

F. Challenge PR comments in a constructive way as all improvement suggestions might not apply

Read more:

This is basically a checklist of what to expect when renting a new home in Mumbai. I have written it exclusively for me to reference.

The Basics

Zameer Ansari

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store