The most common data structures that you’ll get the most out of

Image for post
Image for post
Photo by Alex Ronsdorf on Unsplash

It is quite amazing how you can go from zero to a fully professional software engineer solely with the help of free resources available on the internet. But it can also be noted that developers who take this path often disregard the concept of data structures. They believe that knowledge of these data structures wouldn’t benefit them as they’ll only be developing simple applications.

But on the contrary, I believe learning data structures, right from the start, is essential. Data structures are mainly beneficial for building efficient applications. An application built using data structures will be more efficient than an application built without them. But this does not mean that you should use data structures for each and every requirement. …


Get an in-depth understanding of these two awesome methods

Image for post
Image for post
Photo by Ave Calvar on Unsplash

JavaScript has been steadily improving since its release in 1996. With many improvements coming in the form of ECMAScript versions, the most recent release being ES2020. You can read more about this release over here. I believe one of the prominent updates of JavaScript to be Promises, released in 2015 under the name ES6.

What is a Promise?

The MDN Docs defines a Promise as an object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. This might sound a bit too complicated for newbies.

Jecelyn explains Promises as follows: “Imagine you are a kid. …


Understanding all varieties of decorator functions

Image for post
Image for post
Photo by Manja Vitolic on Unsplash

What is a Decorator?

A decorator is simply a way of wrapping a function with another function to extend its existing capabilities. You “decorate” your existing code by wrapping it with another piece of code. This concept will not be new to those who are familiar with functional composition or higher-order functions.

Decorators aren’t something new. They have been present in other languages such as Python and even in JavaScript under functional programming. We will speak about this later on.

Why Use a Decorator?

Decorators allow you to write cleaner code and achieve composition. It also helps you extend the same functionality to several functions and classes. …


They are here to change the way we code — for good

Image for post
Image for post
Photo by veeterzy on Unsplash

After the release of ES6 in 2015, JavaScript got a few handy upgrades. At the present, a lot of new features were being proposed to be included in the ES2020 version. There are several notable features in the new release and I would love to highlight two of them in this article — Optional Chaining and Dynamic Imports. These two features would have saved me several lines of code and performance if I had used them earlier in my work.

You can read more about the ES2020 features in my previous article over here.

Let’s have a look at these awesome two features. …


Learn what IIFEs are in 6 minutes

Image for post
Image for post
Photo by Jean-Philippe Delberghe on Unsplash

What are IIFEs?

IIFE is the abbreviation for Immediately Invoked Function Expression. Although the term looks long and confusing, it is a quite simple concept. You can easily understand this concept by understanding what each term means.

  1. Immediately Invoked — runs immediately
  2. Function — a typical javascript function
  3. Expression — a javascript expression is a piece of code that simply evaluates to a value

According to MDN Docs, an IIFE is a JavaScript function that runs as soon as it is defined. This would make perfect sense if you look at the three terms I’ve listed above.

Let’s have a look at an IIFE to get a better understanding. …


Choosing what‘s best for your audience

Image for post
Image for post
Photo by Annie Spratt on Unsplash

Why Lazy Load Images?

Performance is crucial in web applications. You can have the most beautiful and engaging website in the world, but if it does not load quickly on the browser, people would tend to skip it. It can be quite tricky to make your website perform really well. This is because of the numerous bottlenecks present in web development such as expensive JavaScript, slow web font delivery, heavy images, etc.

Let’s focus on how images affect your performance. According to Jecelyn, on average a web page consumes 5 MB of data just for images. This can be a heavy burden on the users as it can be very costly in some countries, especially on mobile data. The users will also have issues with site loading times, notably with slower connection speeds. …


A feature that can change the way we JavaScript

Image for post
Image for post
Photo by Ales Krivec on Unsplash

JavaScript is a very flexible and powerful language that has transformed the web in this modern era. One of the main reasons for JavaScript to be dominant in web development is that it is continuously improved with major updates often.

One such proposal is concerning a new feature called “top-level await”. This particular feature enables ES modules to act as async functions. It allows ES modules to await resources and block other modules who import them. The modules who import an awaiting resource can only evaluate the body after the resources have been settled and are ready.

This proposal is currently in stage 3, therefore you can’t directly use it in production. But it is beneficial for you to learn it as it will soon be rolled out in the near future.


Share resources amongst several tabs/workers without any synchronization issues.

Image for post
Image for post
Image by MasterTux from Pixabay

What are Locks?

As computers have now become more powerful, they use several CPU threads to process data. This brings forth newer problems regarding resource sharing as there can be synchronization issues when multiple threads access a single resource.

If you are familiar with threads, you would be aware of the concept of locks. Locks are a method of synchronization that enforces access restrictions to threads such that multiple threads cannot access a single resource at the same time. Although a variant of locks allows multiple threads to access a resource at an instant, it still limits the access to read-only. …


A brighter future for web development with native-like performance

Image for post
Image for post
Photo by Louis Hansel @shotsoflouis on Unsplash

Since the introduction of computers, there has been a massive improvement in the performance of native applications. Comparatively, web applications were quite slow due to the fact that JavaScript was not initially built for speed. But with heavy competition amongst the browsers and the rapid development of JavaScript engines such as V8, enabled JavaScript to run very fast on machines. But it was still not able to beat the performance of native applications. This was mainly due to the fact that the JavaScript code had to undergo several processes to result in machine code.


A mighty addition to the primitive data type

Image for post
Image for post

JavaScript is one of the cores of web development. JavaScript, also known as ECMAScript was standardized in 1997. Since then, the below primitive values were present in the language.

  • Undefined
  • Null
  • Big Int(newly added in ES2020)
  • Boolean
  • Number
  • String

null is labeled as one of the primitive values in JavaScript, since its action is apparently primitive. But in some situations, null is not as “primitive” as it first seems! Every Object is derived from null value, and therefore typeof operator returns an object for it.

But with the release of ES6 in 2015, a newer primitive type — Symbol, was added. They were quite different from the previous primitives. They were simply values, not strings, nor numbers nor even Objects. …

About

Mahdhi Rezvi

JavaScript Geek 😎 — Tech Writer with 1M+ views 👻 — Undergrad at UoM 🇱🇰 ❤️ — https://thisismahdhi.ml

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