Articles on Trending Technologies

Technical articles with clear explanations and examples

Finding the longest consecutive appearance of a character in another string using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 272 Views

Problem We are required to write a JavaScript function that takes in a string as the first argument and a single character as the second argument. Our function should count and return the longest consecutive appearance of the character in the string. Approach We'll iterate through the string and track the current consecutive count and maximum count found so far. When we encounter the target character, we increment the counter. When we encounter a different character, we reset the counter. Example Following is the code − const str = 'abcdaaadse'; const char ...

Read More

crypto.randomBytes() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

The crypto.randomBytes() method generates cryptographically strong pseudo-random data in Node.js. This method ensures sufficient entropy before completion, typically taking only a few milliseconds to generate secure random bytes. Syntax crypto.randomBytes(size, [callback]) Parameters The parameters are described below: size – Specifies the number of bytes to generate. Must not exceed 2**31 - 1. callback – Optional callback function called if an error occurs. If omitted, the method runs synchronously. Asynchronous Example ...

Read More

What is the SectionList component and how to use it in React Native?

Shilpa S
Shilpa S
Updated on 15-Mar-2026 1K+ Views

The SectionList component in React Native provides an efficient way to display data organized in sections with headers. It's perfect for categorized lists like contacts, settings, or grouped items. Key Features Header/Footer support for the entire list Header/Footer support for individual sections Scroll loading and pull-to-refresh functionality Cross-platform compatibility Sticky section headers Basic Syntax import { SectionList } from "react-native"; Important Props ...

Read More

How to add dashes to the border of a selection area on a canvas using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 520 Views

In this article, we are going to learn how to add dashes to the border of a selection area on a canvas using FabricJS. We can achieve this by using the selectionDashArray property. It allows us to make the border of a selection area dashed. Syntax new fabric.Canvas(element: HTMLElement|String, { selectionDashArray: Array }: Object) Parameters element − This parameter is the element itself which can be derived using document.getElementById() or the id of the element itself. The FabricJS canvas will be ...

Read More

How to set the style of controlling corners of a Rectangle using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 279 Views

In this tutorial, we are going to learn how to set the style of controlling corners of a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. The controlling corners of an object allow us to scale, stretch or change its position. We can customize our controlling corners in many ways such as adding a specific colour to it, changing its size etc. We can change the style by using ...

Read More

How to call promise inside another promise in JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 5K+ Views

When working with JavaScript, you may find yourself needing to call a promise inside another promise. While this may seem like a daunting task, it is actually quite simple once you understand the basics of promises. In this article, we will discuss how to call a promise inside another promise in JavaScript. The Basics of Promises In order to understand how to call a promise inside another promise, it is important first to understand the basics of promises. A promise is an object that represents the eventual result of an asynchronous operation. Promises are used in JavaScript to ...

Read More

Is it possible to change the value of the function parameter in JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 4K+ Views

In this article we are going to find out whether it is possible to change the value of the function parameter in JavaScript. A function accepts certain values as parameters and later while calling this function we need to pass values for these parameters as arguments. Typically a function definition contains the name of the function, parameters (optional) and the body of the function. Syntax Following is the syntax for function parameters − function functionName(parameter1, parameter2, parameter3) { // Statements } Yes, it is possible to change the value of ...

Read More

Search a complex object by id property in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 478 Views

Suppose we have a complex JSON Object like this − const obj = { "id": "0001", "fieldName": "sample1", "fieldValue": "0001", "subList": [ { "id": 1001, "fieldName": "Sample Child 1", "fieldValue": "1001", "subList": [] }, { "id": 1002, "fieldName": "Sample Child 2", ...

Read More

Meeting Rooms 2 problem in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 392 Views

We will be given an array of arrays, each subarray consists of exactly two elements indicating the start and end time of a meeting. The task of our function is to find the maximum number of meetings one person can take avoiding the conflict of time. The function should finally return this number. For example − If the input array describing meeting times is − const arr = [[5, 40], [10, 20], [25, 35]]; Then the output should be − const output = 2; because it's not possible to ...

Read More

Returning lengthy words from a string using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 148 Views

We are required to write a JavaScript function that takes in a sentence of words and a number. The function should return an array of all words greater than the length specified by the number. Problem Statement Input: const str = 'this is an example of a basic sentence'; const num = 4; Expected Output: const output = [ 'example', 'basic', 'sentence' ]; Because these are the only three words with length greater than 4. Using for Loop The most straightforward approach is to split the string into ...

Read More
Showing 11711–11720 of 61,303 articles
Advertisements