Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Meeting Rooms 2 problem in JavaScript
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 MoreReturning lengthy words from a string using JavaScript
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 MoreFinding the count of total upside down numbers in a range using JavaScript
Upside Down Numbers Upside down numbers are special numbers that remain identical when rotated 180 degrees. Only certain digits can form upside down numbers: 0, 1, 6, 8, and 9, where 6 becomes 9 and vice versa when rotated. For example, 69 becomes 69 when rotated, and 8108 becomes 8018 (which is not the same, so it's not upside down). Problem Statement We need to write a JavaScript function that takes a range of two numbers and returns the count of all upside down numbers within that range. Understanding Valid Digits When rotated 180 ...
Read Moreagent.maxFreeSockets Property in Node.js
The agent.maxFreeSockets property defines the maximum number of sockets that can be kept open in the free state for connection reuse. This is part of Node.js HTTP agent configuration and helps optimize HTTP connection pooling. Syntax agent.maxFreeSockets = number Parameters number – Specifies the maximum number of sockets that can remain open in the free state. Default value is 256. Understanding Free Sockets Free sockets are HTTP connections that have completed their current request but remain open for potential reuse. This improves performance by avoiding the overhead of establishing new ...
Read MoreList some benefits of using React Native for building mobile apps?
React Native has revolutionized mobile app development by enabling cross-platform applications with a single codebase. As iOS and Android apps gain popularity, companies seek faster, cost-effective development solutions. React Native addresses this need by allowing developers to build native mobile apps using JavaScript and React principles. Originally developed by Facebook as a hackathon project, React Native emerged from the need for a unified framework that could serve both iOS and Android platforms with a single development team. Built on the ReactJS JavaScript library, it provides a robust foundation for creating mobile user interfaces while maintaining native performance. Let ...
Read MoreHow to enable selection of object only when it is fully contained in a selection area in FabricJS?
In this article, we are going to learn how to enable the selection of an object only when it is fully contained in the selection area using FabricJS. We can use the selectionFullyContained property to achieve this. Syntax new fabric.Canvas(element: HTMLElement|String, { selectionFullyContained: Boolean }: 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 ...
Read MoreCreating a Dynamic Report Card using HTML, CSS, and JavaScript
In this article, we are going to build a dynamic report card using the inputs entered by the user. The user will enter student names and marks for different subjects, and our application will automatically calculate the total marks, average percentage, and pass/fail status. We will be using HTML, CSS, and JavaScript for the implementation. This interactive report card system allows teachers or administrators to quickly generate student performance reports by simply entering marks and clicking a calculate button. Project Overview We will create an HTML form with input fields for student name ...
Read MoreGet the number of true/false values in an array using JavaScript?
In JavaScript, you can count true/false values in arrays using various methods. Here are several approaches to accomplish this task. Using filter() Method (Recommended) The most efficient approach is using the filter() method to count values based on conditions: let obj = [ { isMarried: true }, { isMarried: false }, { isMarried: true }, { isMarried: true }, { isMarried: false } ]; // Count true values let trueCount = obj.filter(item => item.isMarried === ...
Read MoreDynamically replace data based on matched RegEx - JavaScript?
Regex (Regular Expressions) is used to match patterns in strings of text. With JavaScript, you can use regex to dynamically replace data based on matched patterns using the replace() method. This article will explain how to use regex and JavaScript together to make dynamic replacements in your code. We'll cover the basics of regex syntax and practical examples for template replacement. Using replace() Method The replace() method in JavaScript searches a string for a specified value or regular expression and returns a new string with replacements. The original string remains unchanged. Syntax string.replace(searchValue, newValue) ...
Read MoreFinding the greatest and smallest number in a space separated string of numbers using JavaScript
We are required to write a JavaScript function that takes in a string containing numbers separated by spaces and returns a string with only the greatest and smallest numbers separated by a space. Problem Statement Given a space-separated string of numbers, find the maximum and minimum values and return them as a formatted string. Input: '5 57 23 23 7 2 78 6' Expected Output: '78 2' Because 78 is the greatest and 2 is the smallest number in the string. Using Array.reduce() Method The most efficient approach uses ...
Read More