A Few Tips To Become A Better Developer

Image for post
Image for post
Photo by Markus Spiske on Unsplash

In the beginning of my career, every time I worked with JavaScript I’ve always been skeptical about if the way I write my code was right. Because, in any programming language there’s no one right way of getting things to work. Nevertheless, one must always remember the things that are not supposed to be done. So, here’s a curated list of things that should not be done in JavaScript that I would like to share.

1. Avoid using var

Always use let or const when you’re trying to declare a variable. If you have a variable that does not require a change then it’s always best to use const. You can ask, why should we not use var? It’s because ES6 has given us let that provides us with block scope that would avoid a lot of problems that would occur when using var — which is function scoped. …


GraphQL Is Way Better

Image for post
Image for post
Photo by bruce mars on Unsplash

REST has been used by many developers to send data over HTTP whereas GraphQL is typically presented as a technology to replace the legacy of REST APIs. In this article, I’ll be explaining the benefits, limitations, and differences between these two, which will help you decide what to chose for your next project.

What is REST?

REST(Representational state transfer) is an API design architecture that’s used to implement web services by using a predefined set of stateless operations (including GET, POST, PUT, and DELETE).

The core idea of REST is that you would retrieve a resource by putting through a request to the resource’s URL and get a response (usually JSON, but it depends on the API). …


You should have a set time to work, a defined workspace, and a daily routine, even though you’re at home

Scrabble tiles forming the words “work from home”
Scrabble tiles forming the words “work from home”
Photo by Nelly Antoniadou on Unsplash

Ever since work from home began, my productivity has had its ups and lows until I found the right way to do it. Since then, it has been at a constant high. During the initial days, all of us must have had mixed feelings. I first thought it would be fun for a while to wake up five minutes before the first meeting and spend all day in pajamas. And I thought avoiding traffic and travel was the best thing that could ever happen to me.

But later on, when burnout kicked me pretty hard, I decided to not let it get to me. I thought it was just me, but later on, when I’d talked to my colleagues who live with their parents or the ones that have kids at home or a noisy neighbor who loves to yell all the time, I realized what the real deal was. Also, being prone to get distracted or to procrastinate has also become extremely common as we are all at home in our own space. We’re the master of our time now as there’s no one around us that we’re scared will judge us. …


Being a Performance Conscious Developer

Image for post
Image for post
Photo by krakenimages on Unsplash

Being a developer, it is essential to worry about the performance of the application that we build. Memory management is one of the major factors that affects the performance of an application. Many a time JavaScript developers tend to not consciously think about memory management because JavaScript automatically allocates memory space when an object is created and collects them later as garbage when they’re not used. These behind the scenes behaviour of garbage collection in JavaScript could cause a lot of confusion. Read further to understand this better.

Memory Life Cycle

There are three steps involved in the memory life cycle of almost all programming…


Clear Cache, JSONView, and more

google chrome logo
google chrome logo
Google Chrome logo

Most of the Web Developers use Chrome for their development. According to Wikipedia about 65% of the world population seem to use Chrome, this is one of the reasons why developers choose Chrome to test an application built by them. So if you’re a developer who uses Chrome a lot, here’s a bunch of Chrome extensions that would make your life a lot easier.

1. Colorzilla

Colorzilla basically provides a color picker widget along with a lot of other features. It has a gradient generator, webpage code analyser, and everything you’d need to deal with colors in your webpage. …


Stay updated with the upcoming features to JavaScript in 2021

Image for post
Image for post
Photo by Ekaterina Shevchenko on Unsplash

Since 2015, JavaScript has been receiving constant yearly updates with new features being added. Though ES2021/ES12 will be released next year, we can already have a look at what’s to come since many features already reached Stage 4(Finished) specification and will be included in the specification. In this article, I will discuss the features that have already reached stage four and are added to the Google Chrome V8 engine.

String.prototype.replaceAll

String.prototype.replace is an existing method that allows us to replace a pattern in a string with something else. One thing to remember in this method is that, when we replace a pattern, only the first occurrence of that pattern in the string would be replaced. …


Or Is It Synchronous?

Image for post
Image for post
Photo by bruce mars on Unsplash

The Problem

In React, we use setState() to update the state of any component. Now setState() does not immediately mutate this state, rather it creates a pending state transition. Accessing the state immediately after calling setState() returns the existing value and not the updated one. As beginners in React, I’m sure most of us would have often faced this problem.

There is no guarantee of synchronous operation on setState() and calls may be batched for performance gains. It is easy to forget that the setState() is asynchronous, making it tricky for us to debug issues in your code. The setState() also does not return a Promise. Using async/await or anything similar will not work. …


Here are a few JavaScript memes that I found hilarious

1. Many are not aware of the power of JavaScript

Image for post
Image for post

2. The spread operator joke never gets old

Image for post
Image for post

3. When in async, we wait…

Image for post
Image for post

4. For the devil that you can be

Image for post
Image for post

5. This meme reminds me about why “===” is important

Image for post
Image for post

6. Interpreted language, you say?

Image for post
Image for post

7. What would I do without “console.log”

Image for post
Image for post

8. JavaScript always manages to surprise me

Image for post
Image for post

9. Well, isn’t JavaScript powerful?

Image for post
Image for post

10. The mystery of “this” in JavaScript

Image for post
Image for post

I hope you could find at least some of the memes relatable. But hey, aren’t they chucklesome?

Laugh out loud and code intensely :)


Image for post
Image for post
Photo by Andy Li on Unsplash

JavaScript Modules are separated by files and loaded asynchronously. Exports are defined using the export keyword and imports are defined using import keyword.

While the basics of imports and exports are simple to understand, there are many other ways to work with ES Modules. In this article, we’ll go over all of the ways in which you can export and import within your modules.

Exports

We’ll be looking into three types of exports:

1. Default Export

Every module has a single default export, which represents the main value that is exported from that module. …


The safe way to access nested properties, even if a property doesn’t exist

Black and white house frame
Black and white house frame
Photo by Jordan M. Lomibao on Unsplash.

Introduction

As described in the MDN docs:

“The optional chaining operator (?.) permits reading the value of a property located deep within a chain of connected objects without having to expressly validate that each reference in the chain is valid.”

In other words, optional chaining with ?. is a safe way to access nested object properties — even if an intermediate property doesn’t exist.

Why Should I Use This?

An object can have a very different nested structure of objects. Working with data in JavaScript frequently involves situations where you aren’t sure that something exists.

Example

As an example, consider objects for app data. Most of our apps have an author in the app.author property with the first name app.author.firstName, …

About

Harsha Vardhan

Engineer, Photographer, Tech Blogger. Builds products and writes for developers. I love to code and love to help others code :)

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