Articles on Trending Technologies

Technical articles with clear explanations and examples

How to check whether a checkbox is checked in JavaScript?

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

In this tutorial, we will learn to check whether a checkbox is checked in JavaScript. The checkbox is an input type in HTML that works as a selection box. Unlike radio buttons which allow users to select only one value from a group, checkboxes allow users to select multiple values. HTML can add checkboxes to webpages, but JavaScript is needed to add behavior based on whether checkboxes are checked or not. We'll learn to check both single and multiple checkboxes. Check if a Single Checkbox is Selected To check if a checkbox is selected, we access the ...

Read More

Is their a JavaScript Equivalent to PHP explode()?

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 2K+ Views

The JavaScript equivalent to PHP's explode() function is split(). Both functions break a string into an array based on a specified delimiter. Syntax string.split(separator, limit) Parameters separator: The character or string to split by (required) limit: Maximum number of splits (optional) Basic Example JavaScript split() Example var str = '087000764008:Rank:info:result'; var arr = str.split(":"); ...

Read More

What is the correct use of schema.org SiteNavigationElement in HTML?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 877 Views

The schema.org SiteNavigationElement extends WebPageElement and is used to mark up navigation links on a webpage. It helps search engines understand your site's navigation structure and can enhance search result displays with sitelinks. Basic Syntax The SiteNavigationElement uses microdata attributes to define navigation properties: Link Text Key Properties The main properties used with SiteNavigationElement are: url - The destination URL of the navigation link name - The visible text or name ...

Read More

Change the style of left border with CSS

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

The border-left-style property in CSS allows you to change the style of an element's left border. This property accepts various values like solid, dashed, dotted, double, and more to create different visual effects. Syntax border-left-style: value; Available Border Styles The border-left-style property accepts several values: solid - A single solid line dashed - A series of dashes dotted - A series of dots double - Two parallel lines groove - A 3D grooved border ridge - A 3D ridged border inset - A 3D inset border outset - A 3D outset border ...

Read More

Write a number array and add only odd numbers?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 1K+ Views

In JavaScript, you can sum only the odd numbers from an array by using the modulus operator (%) to check if a number is odd, then adding it to a running total. How It Works The modulus operator returns the remainder when a number is divided by 2. If the remainder is not equal to 0, the number is odd. Example: Summing Odd Numbers var tot = 0; var a = [1, 45, 78, 9, 78, 40, 67, 76]; ...

Read More

How to generate a random number in JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 2K+ Views

JavaScript's Math.random() method is the built-in way to generate random numbers. It returns a floating-point number between 0 (inclusive) and 1 (exclusive), which can be scaled to any desired range. The Math.random() function returns a pseudo-random number in the range [0, 1) with uniform distribution. The implementation generates the seed automatically, and users cannot modify it. Basic Math.random() Usage Syntax Math.random() Return Value A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). Example Random Number Generation ...

Read More

How to remove every Nth element from an array JavaScript?

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

Removing every Nth element from an array is a common task in JavaScript. This can be accomplished using the Array.prototype.splice() method to modify the array in-place, or by creating a new array with the filtered elements. Method 1: Using splice() (In-Place Modification) The splice() method removes elements from the array and modifies the original array: const arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; console.log("Original array:", arr); const removeNth = (arr, n) => { // Start from n-1 index and remove every nth element ...

Read More

The best way to remove duplicates from an array of objects in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 283 Views

When working with arrays of objects in JavaScript, removing duplicates requires checking specific properties rather than comparing entire objects. Here are the most effective approaches. Sample Data Let's use this array of student objects with duplicate IDs: var studentDetails = [ {studentId: 101}, {studentId: 104}, {studentId: 106}, {studentId: 104}, {studentId: 110}, {studentId: 106} ]; console.log("Original array:", studentDetails); Original array: [ { studentId: 101 }, ...

Read More

Finding tidy numbers - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 321 Views

A tidy number is a number whose digits are in non-decreasing order. We are required to write a JavaScript function that takes in a number and checks whether its a tidy number or not. For example: 489 is a tidy number 234557 is also a tidy number 34535 is not a tidy number Understanding Tidy Numbers In a tidy number, each digit should be less than or equal to the next digit when reading from left to right. For instance, in 234789, we have 2 ≤ 3 ≤ 4 ≤ 7 ≤ 8 ≤ ...

Read More

How to get a decimal portion of a number with JavaScript?

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

In JavaScript, you can extract the decimal portion of a number using several methods. The most common approach is using the modulo operator (%) with 1. Using the Modulo Operator (%) The % operator returns the remainder after division. When used with 1, it gives the decimal part: var num1 = 5.3; var num2 = 4.2; var num3 = 8.6; document.write(num1 ...

Read More
Showing 17101–17110 of 61,297 articles
Advertisements