JavaScript is a dynamic language. This makes JavaScript a supercool language to start. However, It is very hard to write better and safe code. One small mistake can lead to a bigger issue. Error handling plays a vital role to reduce the number of bugs. If you handle error elegant way, it will save a lot of time in the future. So the bigger question is how you should handle the error.
Let’s take one example.
const express = require("express")
const app = express()
app.get("/", (_, res) => res.end("OK"))app.listen(80)
JS|TS By Example
You work on multiple projects. Most of the time you repeat your self while writing common util functions. Here are some of the most useful utilities that you can use for your TypeScript or JavaScript
1. compact: Compact is normally used to remove the falsy value from an Array. There are multiple variations of it.
Simple Variant: filter out falsy values (false
, null
, 0
, ""
, undefined
, and NaN
).
// Code:
const compact = (arr = []) => arr.filter(Boolean);// How to use it compact([0, 1, false, 2, "", 3, "a", Number("e") * 23, NaN, "s", 34]); //…
For the past few years, I have almost stopped writing JavaScript. You may ask why. It doesn't mean I don't like JavaScript. However, there is a better version of JavaScript, TypeScript. Yes, I have started developing all my library and application in TypeScript. It includes the backend too.
Here in this article, I will try to answer the question of why you should use TypeScript instead of JavaScript. This article does not cover the pros and cons of JavaScript. Rather than just focus on Good Parts of TypeScript.
Writing a command-line app is a challenge in many object-oriented languages. Most the object-oriented languages need heavy lifting structure(source code) to run a simple program. Java/Kotlin is one of them. Here, Gradle comes to save us.
Gradle is a framework helping us to create and maintain big applications. Gradle is awesome. However, setting up Gradle is also a tedious task. Here I will show step by step setup to build a scalable CLI(Command Line Interface) tool in Kotlin.
Create a folder and scaffold the structure with Gradle.
mkdir…
This is the first part of a series of articles that will help you to prepare for coding challenges. In this article, I will focus on the problems related to JavaScript strings.
Prerequisite: Before going forward, I am assuming you should have basic knowledge of JavaScript. At least you should know how it works.
Note: This is not a copy of Gayle_Laakmann’s book. The book is awesome. I love reading it whenever I get time. However, some samples/questions are taken from the book. While the book solves problems using Java, I have solved the same questions with JavaScript (TypeScript).
Strings…
There are a lot of tutorials to create Apollo Server and adding typing to it. However, creating a better project structure requires in-depth knowledge of Node.js and Apollo Server. Here in this article, I will explain the step-by-step process to build a robust and scalable server.
Before going further, I assume you have basic knowledge of Node.js and TypeScript. If you are new to Node.js, Please have a look at some basic tutorials on Node.js.
First, We need to create a project and init the configuration.
## Create a folder
mkdir apollo-server
cd apollo-server## Init npm package
npm init…
Creating a better UX is not as simple as it looks. Every component on-page matters. While working on a complex piece of code, we almost forgot about the simplest thing, a broken image.
Here in this tutorial, I will explain how you can create a simple Image
component without breaking existing code. This component will support lazy loading and broken images.
To start with, first create a folder in your component library and create a file named index.tsx
.
mkdir -p components/Image
touch components/Image/index.tsx
Add below line to index.tsx
.
// components/Image/index.tsx
import React from "react";interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {}export…
Deno By Example
Before starting code, Let's understand the concept of CICD in brief. This will give us the motive to read this blog further.
Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
By- ThoughtWorks’ definition for CI
Read more: https://www.thoughtworks.com/es/continuous-integration
Continuous Delivery is the ability to get changes of all types — including new features, configuration changes, bug fixes, and experiments — into production, or into the hands of users, safely…
Currently setting up a Server Side Render (SSR) application is a pain in nodejs. There are many scaffolds available for nodejs. But it comes with its own tech-depth and learning curves. This also includes hidden configurations of Webpack.
All in all, when you give Webpack a chance, your encounter will rarely be a pleasant one.
Read More: https://www.north-47.com/knowledge-base/webpack-the-good-the-bad-and-the-ugly/
According to the wiki, An isomorphic JavaScript(also known as Universal JavaScript) is described as JavaScript applications that run both on the client and the server.
If I say, you can build an entire SSR without setting up installing any external nodejs dependency…
In the world of data, the Security of personal data is the biggest concern of anyone. Knowingly or unknowingly we share a lot of data to the company like Google and Facebook. In the old era, we have made walls/doors to protect our property from external threats. So now how far you will go to protect you and your beloved property.
In this article, I will explain how you can protect your data using some basic tips. You don't have to be super technical to protect you.
To protect your assets, First, you have to understand what assets do you…
I am UI/UX lead developer, tech enthusiastic person. I am working in one of the biggest FinTech company, trying to solve basic challenges on ground issues.