Articles on Trending Technologies

Technical articles with clear explanations and examples

Aggregate records in JavaScript

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

Aggregating records in JavaScript involves combining multiple objects with the same identifier into a single object with accumulated values. This is commonly used for data analysis tasks like summing transactions by person or grouping sales by product. Let's say we have an array of objects that contains information about some random transactions carried out by some people: const transactions = [{ name: 'Rakesh', amount: 1500 }, { name: 'Rajesh', amount: 1200 }, { name: 'Ramesh', ...

Read More

How to count digits of given number? JavaScript

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

The requirements here are simple, we are required to write a JavaScript function that takes in a number and returns the number of digits in it. For example − The number of digits in 4567 is 4 The number of digits in 423467 is 6 The number of digits in 457 is 3 Let's explore different approaches to count digits in JavaScript. Method 1: Using Recursive Approach This method uses recursion to divide the number by 10 until it reaches zero: const num = 2353454; const digits = (num, count = ...

Read More

Split First name and Last name using JavaScript?

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

In JavaScript, you can split a full name into first and last name using the split() method. This method divides a string based on a specified separator and returns an array of substrings. Syntax string.split(separator) Basic Example var studentFullName = "John Smith"; var details = studentFullName.split(' '); console.log("Student First Name = " + details[0]); console.log("Student Last Name = " + details[1]); Student First Name = John Student Last Name = Smith Handling Multiple Names For names with more than two parts, you can extract the first ...

Read More

Checking Oddish and Evenish numbers - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 317 Views

A number is Oddish if the sum of all of its digits is odd, and a number is Evenish if the sum of all of its digits is even. We need to write a function that determines whether a number is Oddish or Evenish. The function should return true for Oddish values and false for Evenish values. How It Works The algorithm extracts each digit from the number, adds them up, and checks if the sum is odd or even: Extract digits using modulo (num % 10) and integer division (Math.floor(num / 10)) Sum all ...

Read More

How to show image in alert box using JavaScript?

Nancy Den
Nancy Den
Updated on 15-Mar-2026 2K+ Views

JavaScript's default alert() function cannot display images. To show an image in an alert-like dialog, you need to create a custom modal dialog using HTML, CSS, and JavaScript. Why Default alert() Cannot Show Images The browser's built-in alert() function only accepts text strings. It cannot render HTML elements like images, making a custom solution necessary. Creating a Custom Image Alert Here's a complete example that creates a custom alert dialog with an image: ...

Read More

How to convert Number to String in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 4K+ Views

This tutorial will teach us to convert the number to string in JavaScript. Changing the type of variable is called the type conversion of a variable. While coding, the programmer needs to deal with the different data types and might need to convert the variable's data type. Every programming language has different methods to convert one variable from one data type to another data type, and JavaScript also has some methods, which are explained below. Using the toString() Method Concatenating with an empty String Using ...

Read More

How to create a JavaScript code for multiple keys pressed at once?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 755 Views

Use the keydown and keyup events in JavaScript to detect multiple keys pressed simultaneously. This technique tracks which keys are currently held down and updates the display accordingly. Example: Multiple Key Detection Multiple Keys Detection .key-up { color: red; } .key-down { color: green; } ul { list-style-type: none; } ...

Read More

Display video inside HTML5 canvas

Rishi Rathor
Rishi Rathor
Updated on 15-Mar-2026 583 Views

You can display video inside an HTML5 canvas by using the drawImage() method to render video frames onto the canvas. This technique is useful for applying real-time effects, overlays, or custom controls to video content. Basic Setup First, create the HTML structure with both video and canvas elements: Video in Canvas Your browser does not support the video tag. ...

Read More

Usage of border-bottom-color property in CSS

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 78 Views

The border-bottom-color CSS property sets the color of an element's bottom border. It only affects the color when a border style is already defined. Syntax border-bottom-color: color | transparent | inherit; Parameters The property accepts these values: color - Any valid CSS color value (hex, RGB, named colors) transparent - Makes the border invisible inherit - Inherits the color from parent element Example: Basic Usage ...

Read More

How to set a countdown timer in javascript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 9K+ Views

We can set a countdown timer in JavaScript using the setInterval() method. This method continuously calls a function or executes a code snippet with a fixed time delay between every call. The setInterval() method calls a function at described intervals in milliseconds. It continues calling the function until the clearInterval() is called, or the window is closed. Syntax Following is the syntax of this method − setInterval(function, milliseconds); Parameters The setInterval method accepts two parameters: function − A function containing a block of code designed to perform ...

Read More
Showing 17181–17190 of 61,297 articles
Advertisements