JavaScript is a scripting language, therefore you can write scripts to automate your workflow with JavaScript.

Image for post
Image for post

The background of the snippet

I created a node script recently to automate one workflow that I do repeatedly. Every time I create a new JavaScript project, I’d create a .prettierrc file and add 4 configurations.

The file looks something like this,

For those who don’t know what this is, it is a configuration file for prettier. You can install it in your code editor to format your source code in a certain way.

The configuration I created above will make sure that my JS source code will have a semicolon at the end, it will use a single quote on strings, it will use 2 spaces for indentation and instead of using tabs, the editor will use space for formatting indentations. …


In this article, you will learn to build a Markdown parser which compiles into HTML with JavaScript and Regular Expression

Markdown is a markup language like HTML. It is quite popular among developers to write blogs, readme files, and documentation. Some of the popular websites that support rich text like Reddit, GitHub, Notion etc allow you to write Markdown. I use Markdown to convert my blog from a Markdown file to HTML web pages. Markdown is simple yet very powerful. In this blog, I will be writing about how to build a simple Markdown parser to convert Markdown to HTML with JavaScript using Regular Expressions.

Image for post
Image for post
Markdown Parser

How does Markdown text look like

If you open a markdown file, you’ll see the following syntax.

Markdown text example

Learn more from this Markdown cheatsheet. …


Handling error in express applications can be more challenging than building web applications and APIs

Building web applications or APIs with express.js is not difficult in my opinion. I think it is more difficult to handle errors, error status codes and error messages properly. Below, I’m going to list out a few techniques by which I handle errors in my express.js applications.

We need to understand middleware to handle errors if you want to apply the technique I am going to suggest. Simply, a middleware in express is a function that has access both the request and the response objects for a particular route. …


A framework or library is just a set of tools that are created to solve a recurring problem more efficiently. Hence, there’s nothing that vanilla JS can’t solve which can be solved by using a framework like React, Angular or Vue. Most of the people jump into learning frameworks before learning enough JavaScript. It is not totally wrong but there’s just one problem. If one doesn’t have enough experience learning core JavaScript, he doesn’t know the benefits the particular framework/library provides nor the problem it tries to solve. So developers/programmers need to have a clear idea about what the framework is trying to provide and what is available in the language itself. …


This blog is targetted to beginners who are learning React JS. It is going to be a short blog in which I will talk about making an API request in React JS. I will link the core concepts required to make API calls to the official documentation of react as we encounter them in the story.

First of all, create a react project. To do so, you can use the create-react-app package provided by Facebook. I am assuming that you know how to do so. If you don’t, use the following steps to do so. …


To write this blog I asked people of a techy facebook group a few questions. I just wanted to know if people customize their system or not and why do they do so? In this blog, I want to talk about the answers I got, my opinion on customization and how can you customize your computer for better workflow. I would like to mention that it is an opinionated blog so your preferences might be different.

Image for post
Image for post

Answers review and my opinion

According to the answers I got in the post, most people responded that they go with a fairly minimal level of customization. They are pretty much satisfied with what they get out of the box and add little tweaks. It is a personal preference and there’s no right or wrong when it comes to how you make your computer look like. …


Solving coding challenges is one of my favourite things to do. Whenever I get free time, I log into hackerrank and start solving the challenges. Some are tough and some are very easy. This is going to be a series of blogs in which I will be writing about how I solved a particular coding challenge. I will be writing codes in JavaScript but the logic will be valid for all programming languages. Also, I will be writing solutions on step by step basis so it will be awesome if you could follow along with the entire story so you get the idea of how things work. …


A higher-order function is a function that either returns a function or takes in a function as an argument. Map, filter and reduce are some of the built-in higher-order functions in JavaScript. They can be used in arrays and I am going to briefly describe how to work with map and filter in this blog.

Map

The map method called on an array will return the array of the same size. The returned array can be the result of the operation you apply on the array call the method on.

Image for post
Image for post
An example of a map function

Here in the above example, in line no 2, the map method is called on the object. The map function takes a callback as an argument. Here the arrow function that takes x as a parameter and returns two times of x is the callback function. Here the map function iterates over every single element in the numbers array and stores 2 times of the current value in the twiceOfNumbers array. The solution can also be implemented as the code given…


The year 2018 has become the best year of my life till date. I was able to achieve so much in the entire year. I have always wanted to learn, explore, grow and be a better version of myself and in 2018, I really achieved a lot of those. In this blog, I want to talk about the things that happened to me or made them happen which made my year remarkable. …


A little bit of History

I was a sublime text fanboy before I started using Visual Studio Code. I would like to address some issues here. I was kind of a beginner back then and I had no idea about the performance of text editors. All I cared about is syntax completion and highlighting, themes (dark themes to be precise) and that’s probably it. I heard from the people I worked with about the performance of Sublime text being superior to other text editors but I didn’t care much about that back then. So why exactly did I switch?

React JS

The main reason why I switched to Visual Studio Code is React JS. Like all text editors, sublime text makes syntax highlighting and predictions according to the type of file you’re using. That makes perfect sense. The files that React is written in is a JavaScript file with .js extension. That is also fine but the problem is, React uses something called JSX which doesn’t go well through syntax highlighting on Sublime text. Now, I know, switching the syntax highlighting to Babel would have solved the issue but as a beginner, I did not know that. …

About

Prashant Acharya

A Computer Science enthusiast who enjoys sharing what he learns

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