Articles on Trending Technologies

Technical articles with clear explanations and examples

Converting km per hour to cm per second using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 761 Views

We are required to write a JavaScript function that takes in a number that specifies speed in kmph and it should return the equivalent speed in cm/s. Understanding the Conversion To convert km/h to cm/s, we need to understand the relationship: 1 kilometer = 100, 000 centimeters 1 hour = 3, 600 seconds Formula: km/h × (100, 000 cm / 1 km) × (1 hour / 3, 600 seconds) Example Following is the code: const kmph = 12; const convertSpeed = (kmph) => { const secsInHour = ...

Read More

Achieving maximum possible pair sum in JavaScript

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 300 Views

The maximum possible pair sum is a traditional problem in Data Structures and Algorithms (DSA). In this problem, we calculate the sum of two elements (i.e., pairs) in an array such that the resulting sum is the maximum among all possible pair sums. For example, we have an array [1, 2, 3, 4]. The sum of the pair (3, 4) is 7, which is the maximum among all pair sums in the given array. Problem Statement We have given an array named nums[], and our task is to write a JavaScript program to achieve the maximum possible ...

Read More

What is difference between unescape() and escape() functions in JavaScript?

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

JavaScript provides two legacy functions for dealing with encoded strings: escape() and unescape(). The escape() function encodes a string, making certain characters safe for URLs, while unescape() decodes an encoded string back to its original form. ⚠️ Important: Both escape() and unescape() are deprecated. Use encodeURIComponent()/decodeURIComponent() or encodeURI()/decodeURI() instead. Syntax escape(string) unescape(encodedString) Key Differences Function Purpose What it does escape() Encodes special characters Converts characters like spaces, punctuation to %XX format unescape() Decodes encoded characters Converts %XX sequences back to original characters ...

Read More

How to add image smoothing for an Image using FabricJS?

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

In this tutorial, we are going to show how you can add image smoothing for an Image using FabricJS. Smoothing gives a smooth effect to the image. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to add image smoothing, we use the imageSmoothing property. Syntax new fabric.Image(element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, ...

Read More

Top Practical Applications of JavaScript

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 603 Views

JavaScript has evolved far beyond its origins as a simple scripting language for web pages. Today, it powers everything from mobile apps to artificial intelligence, making it one of the most versatile programming languages available. Originally designed to add interactive elements to websites, JavaScript has grown into a full-stack development powerhouse. Its ability to run on both client and server sides, combined with a vast ecosystem of frameworks and libraries, has opened up countless possibilities for developers across different domains. Practical Applications of JavaScript JavaScript's flexibility allows developers to build diverse applications across multiple platforms and industries. ...

Read More

How to create a canvas with Polygon using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 1K+ Views

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Syntax new fabric.Polygon(points: Array, options: Object) Parameters points − This parameter accepts an Array which denotes the array of points that make up the polygon object. ...

Read More

How to find specific words in an array with JavaScript?

Disha Verma
Disha Verma
Updated on 15-Mar-2026 1K+ Views

Finding specific words in an array is a common task in JavaScript, especially when you need to filter data, search through lists, or analyze text. An array is a simple and fundamental data structure in JavaScript that stores multiple values of the same data type. JavaScript has several built-in methods, like includes(), filter(), and find(), that help you search for specific words easily. This article will explain these methods with examples. Finding Specific Words in an Array Finding specific words in an array can be done in the following ways: Using includes() ...

Read More

Finding count of special characters in a string in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

In JavaScript, you can count special characters in a string by checking each character against a predefined set of special characters. This is useful for text validation, content analysis, or data processing tasks. Problem Statement We need to count occurrences of these special characters in a string: '!', ', ', ''', ';', '"', '.', '-', '?' The function should iterate through each character and increment a counter when it finds a match. Example Implementation const str = "This, is a-sentence;.Is this a sentence?"; const countSpecial = str => { ...

Read More

Sort array according to the date property of the objects JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 220 Views

In JavaScript, sorting an array of objects by date requires converting date strings to Date objects for proper comparison. The Array.sort() method with a custom comparator function handles this efficiently. Sample Data Consider an array of objects with date properties: const arr = [ {date: "2016-06-08 18:10:00"}, {date: "2016-04-26 20:01:00"}, {date: "2017-02-06 14:38:00"}, {date: "2017-01-18 17:30:21"}, {date: "2017-01-18 17:24:00"} ]; Using Array.sort() with Date Comparison The most straightforward approach uses Array.sort() with a ...

Read More

Check if the string is a combination of strings in an array using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 268 Views

We are required to write a JavaScript function that takes in an array of strings as the first argument and a string as the second argument. The function should check whether the string specified by second argument can be formed by combining the strings of the array in any possible way. For example − If the input array is − const arr = ["for", "car", "keys", "forth"]; And the string is − const str = "forthcarkeys"; Then the output should be true, because the string is a combination of elements ...

Read More
Showing 16541–16550 of 61,297 articles
Advertisements