Tag: web

TypeScript Setup

Below are the tools you need to set up with the environment to start writing TypeScript code: Node.js – Node.js is the environment in which you will run the TypeScript compiler. TypeScript compiler – a Node.js module that compiles TypeScript into JavaScript. If you use JavaScript for node.js, you can install the ts-node module. It is a TypeScript execution and REPL for node.js Visual Studio Code – It is a code editor that supports TypeScript. However, you can use your favourite editor. If you use VS Code, you can install the following extension to speed up the development process: Live Server...

Read More

Introduction to TypeScript

What is TypeScript A superset of JavaScript is TypeScript. The foundation for TypeScript is JavaScript. You begin by writing the TypeScript code. The TypeScript code is then converted into standard JavaScript code using a TypeScript compiler. Once you have the basic JavaScript code, you can use it anywhere JavaScript is supported. TypeScript files use the .ts extension rather than the .js extension of JavaScript files. In addition to using JavaScript syntaxes, TypeScript also introduces new syntaxes to support types. A TypeScript program is one that is written in JavaScript and doesn’t have any syntax errors. It means that all JavaScript programs are TypeScript...

Read More

Understand CSS functional pseudo-class selectors :is() and :where()

Long selector lists can occasionally result from developing CSS in order to target numerous items with the same style rules. A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). Both :is() and :where() are pseudo-class functions that will help shorten and avoid repetition in creating the selectors. They both take an array of arguments of selectors (ids, classes, tags, etc..) and selects any element that can be selected in that list. Read this blog post or watch the video below to learn more about the :is() and :where(). Problem Statement When we...

Read More

Fill an Array with Initial Values in JavaScript

Arrays can be initialised with data in a variety of ways in JavaScript. Let’s examine which methods are the easiest and most popular in this post.   Read this blog post or watch the video below to learn more about different ways to fill an array with initial values in JavaScript. #1 Fill an array with primitives Let’s say, you want to initialize an array of elements 5 with the number 1. You can use the array.fill(initialValue) method to initialize an array. This method will return the modified array. The thing that you need to keep in mind is the...

Read More

Sparse vs Dense Arrays in JavaScript

Arrays in JavaScript is a very important concept. Developers are dealing with Arrays like creating, manipulating etc almost every day while implementing logics. Arrays are very easy to understand in JavaScript. An array is a special variable, which can hold more than one value But do you know that Arrays can hold nothing i.e. it is possible to create hole in an Array? In this post, I will be discussing about Sparse and Dense Arrays. Also I will be talking about how to create them and what you can do with this type of arrays. I have written a...

Read More