Browsing:

Category: JS

Three consecutive dots (…) in JS

he “dripple dots” you mentioned are called the spread operator in JavaScript. It is represented by three consecutive dots (…) and is used to expand or spread iterable elements (like arrays or objects) into individual elements. Here’s a brief overview Read more…


The distinction between ({ note, onDelete }) and (note, onDelete)

The distinction between ({ note, onDelete }) and (note, onDelete) is applicable to both JavaScript and TypeScript. Key Difference: JavaScript Example: Destructuring (({ note, onDelete })) Here, Note expects a single object as its parameter, and then destructures the note Read more…


In React, useEffect and useState

In React, useEffect and useState are two of the most commonly used hooks, each serving different purposes in managing component behavior and state. 1. useState: useState is a hook that allows you to create and manage state in functional components. Read more…


JavaScript (JS) vs TypeScript (TS) Overview:

Comparison of TypeScript with JavaScript JavaScript Example: TypeScript Example: Advantage: TypeScript enforces that both a and b are numbers, catching type errors at compile time. Type Annotations in TypeScript vs Python In TypeScript, types are applied similarly to how Python Read more…


if (data !== null) vs if (data)

1. if (data !== null) vs if (data) if (data !== null) (Explicit null Check) In JavaScript, if you want to check explicitly whether a value is not null, you can use the !== operator. You can also check for Read more…


Understanding When to Make Copies of Data Before Modifications in JS

In JavaScript, the behavior of reference types extends beyond just arrays. Here’s a list of reference types where the same behavior applies—changes to nested structures will impact all references: 2.Arrays: Arrays are reference types. Similar to objects, assigning an array Read more…