Articles on Trending Technologies

Technical articles with clear explanations and examples

How to replace default meta tag from "layout" with customizing meta tags in "view" with HTML?

usharani
usharani
Updated on 15-Mar-2026 302 Views

Meta tags provide essential information about HTML documents, including descriptions, keywords, and author details. When building web applications, you often need default meta tags in your layout that can be customized for specific pages or views. The most effective approach is to define default meta tags in your application configuration and override them in individual views when needed. This ensures consistent metadata while allowing page-specific customization. Step 1: Configure Default Meta Tags First, define your default meta tag values in the application configuration file: Step 2: Register Meta Tags in Layout ...

Read More

Usage of text-transform property in CSS

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 175 Views

The text-transform property in CSS is used to control the capitalization of text content. It allows you to transform text to uppercase, lowercase, capitalize first letters, or leave it unchanged. Syntax text-transform: value; Property Values Value Description none No transformation (default) capitalize Capitalizes the first letter of each word uppercase Converts all text to uppercase lowercase Converts all text to lowercase Example Text Transform Example ...

Read More

How to convert JavaScript objects to primitive data types manually?

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 731 Views

In JavaScript, objects can be converted to primitive data types (string, number, boolean) using built-in methods. This conversion is essential for operations that require primitive values rather than object references. JavaScript provides several methods for manual conversion including toString(), toDateString(), and valueOf(). Each method serves different conversion purposes and returns specific primitive types. Using the toString() Method The toString() method converts any JavaScript object to its string representation. This method is available on all objects and returns a string primitive. Syntax object.toString() Example Converting various object types to strings: ...

Read More

An element inside another element in JavaScript?

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 10K+ Views

In JavaScript, accessing elements nested inside other elements is a common task when working with the DOM. We can access inner elements using various methods and check containment relationships using the contains() method. JavaScript provides several ways to access nested elements. The most common approach uses getElementsByTagName() on a parent element, while contains() helps verify parent-child relationships. Accessing Nested Elements To access an element inside another element, we first get the parent element, then search within it: document.getElementById('parentID').getElementsByTagName('tagName')[index] document.getElementById('parentID').getElementsByClassName('className')[index] Method 1: Using getElementsByTagName() This example shows how to access and modify elements ...

Read More

Can we re-throw errors in JavaScript? Explain.

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 264 Views

Yes, JavaScript allows you to re-throw errors after catching them using the throw statement inside a catch block. This technique is useful for conditional error handling, logging, or passing errors up the call stack. What is Re-throwing? Re-throwing means catching an error, performing some operation (like logging or validation), and then throwing the same or a new error to be handled elsewhere. Basic Syntax try { // Code that may throw an error } catch (error) { // Handle or log the error ...

Read More

Intersection of two arrays JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 751 Views

Finding the intersection of two arrays means finding elements that appear in both arrays, preserving the frequency of each element as it appears in both arrays. For example, if we have arr1 = [1, 2, 3, 1] and arr2 = [1, 3, 1], the intersection is [1, 3, 1] because element 1 appears twice in both arrays, and element 3 appears once in both. Problem Statement Given two arrays of numbers, we need to write a function that computes their intersection and returns an array containing the intersecting elements. Each element in the result should appear as ...

Read More

How to compare two arrays to see how many same elements they have in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 457 Views

Let's say, we have two arrays, one contains the correct answer strings of some questions and one contains the answers attempted by a candidate, but somehow the arrays got shuffled and now they don't have answers in corresponding order. But we can be sure that no two questions had the same answers. Our job now is to write a function that takes these two arrays, checks them for common elements and finds all the common elements between them and then calculates the marks percentage of the candidate based on the count of common answers. Example const ...

Read More

JavaScript - convert array with null value to string

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 674 Views

In this article, we will learn to convert an array with a null value to a string in Javascript. Handling arrays containing null, undefined, and falsy values in JavaScript is a frequent challenge. The default methods might not behave as expected when converting such arrays to strings, requiring custom solutions for meaningful string representations. Problem Statement Given an array containing null, undefined, empty strings, and other values, the task is to concatenate its elements into a single string while excluding the unwanted values. Following is our array, with some null and undefined values − Input ...

Read More

Finding the intersection of arrays of strings - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 814 Views

We need to find the intersection of two arrays of strings and return an array containing the common elements. Each element in the result should appear as many times as it shows in both arrays. For example − If input is − arr1 = ['hello', 'world', 'how', 'are', 'you']; arr2 = ['hey', 'world', 'can', 'you', 'rotate']; Then the output should be − ['world', 'you'] Approach For unsorted arrays, we need to check every value of the first array against the second array. This approach has O(n²) time complexity. We ...

Read More

How to get the port number part of the href attribute of an area in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 543 Views

In this tutorial, we will discover how to get the port number of the href attribute of an area in JavaScript. An area is a tag in JavaScript. This tag is written as . This tag denotes an area inside an image map. This tag has no closing tag. So in HTML, this is an empty tag. In XHTML, this tag must be closed correctly. An image map is also another tag. This tag is written as . An image map contains an image with clickable or active areas. The area tag comes inside the map ...

Read More
Showing 18501–18510 of 61,297 articles
Advertisements