Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

jQuery Mobile: Sending data from one page to the another

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 288 Views

jQuery Mobile provides several methods to pass data between pages. The most common approaches include URL parameters, localStorage, and sessionStorage. Method 1: Using URL Parameters Pass data through the URL query string when navigating between pages. HTML Link with Parameters Go to New Page JavaScript to Extract Parameters $(document).on("pageinit", "#new", function(event) { // Get URL parameters var url = $(this).data("url"); if (url) { ...

Read More

Set the top margin of an element with CSS

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

The margin-top property specifies the top margin of an element in CSS. It creates space above an element, pushing it away from adjacent elements or the container's top edge. Syntax margin-top: value; The value can be specified in pixels (px), percentages (%), em units, or set to auto for automatic margin calculation. Example CSS margin-top Example This ...

Read More

Add elements to a Queue using Javascript

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

In JavaScript, there is no built-in queue data structure like other programming languages. However, you can implement a queue using an array object and perform operations like push() to add elements at the end and shift() to remove the first element. The following diagram illustrates the queue data structure and its FIFO (First In, First Out) principle: 10 20 30 40 ...

Read More

Safely setting object properties with dot notation strings in JavaScript

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 1K+ Views

In JavaScript, safely setting nested object properties can be challenging because accessing undefined nested paths throws errors. This article covers two approaches: using Lodash's set method and creating a custom solution. Using Lodash's set() Method Lodash provides a safe set method that handles nested property assignment without throwing errors, even if intermediate properties don't exist. let _ = require("lodash"); let obj = { a: { b: { foo: "test" ...

Read More

How to find elements of JavaScript array by multiple values?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 401 Views

In JavaScript, you can find elements of an array by multiple values using various methods. The most common approaches are using filter() with includes() or checking if an array contains all elements from another array. Method 1: Using filter() with includes() This method filters an array to find elements that match any of the specified values: Find Elements by Multiple Values Find Array Elements by Multiple Values ...

Read More

Get unique item from two different array in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 245 Views

We are required to make a function that accepts an array of arrays, and returns a new array with all elements present in the original array of arrays but remove the duplicate items. For example − If the input is − const arr = [ [12, 45, 65, 76, 76, 87, 98], [54, 65, 98, 23, 78, 9, 1, 3], [87, 98, 3, 2, 123, 877, 22, 5, 23, 67] ]; Then the output should be single array of unique elements like this − ...

Read More

How to inherit CSS properties of parent Element using JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 523 Views

JavaScript provides several ways to make child elements inherit CSS properties from their parent elements. You can use classList.add() to apply CSS classes, or directly manipulate the style property to inherit specific styles. Using classList.add() Method The most common approach is creating elements and adding CSS classes that define inheritance rules. CSS Inheritance Example .parent-container { ...

Read More

Find the primorial of numbers - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 419 Views

The primorial of a number n is equal to the product of the first n prime numbers. This is different from factorial, which multiplies consecutive integers. For example, if n = 4, we need the first 4 prime numbers: 2, 3, 5, and 7. 2 × 3 × 5 × 7 = 210 Let's write a JavaScript function that calculates the primorial of a given number. Understanding Prime Numbers First, we need a helper function to check if a number is prime: const isPrime = n => { ...

Read More

How to set the length of the item relative to the rest with JavaScript?

Abhinaya
Abhinaya
Updated on 15-Mar-2026 200 Views

Use the flex property in JavaScript to set the length of flex items relative to each other. The flex property controls how much space a flex item should take up within a flex container. Syntax element.style.flex = "value"; The flex value can be a number (flex-grow), or a combination of flex-grow, flex-shrink, and flex-basis values. Example #box { ...

Read More

Align HTML5 SVG to the center of the screen

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 4K+ Views

SVG stands for Scalable Vector Graphics and it is a language for describing 2D-graphics and graphical applications in XML. HTML5 provides native SVG support, and centering SVG elements on a webpage requires specific CSS techniques. Method 1: Using Auto Margins and Display Block The simplest way to center an SVG horizontally is using auto margins with display block: #svgelem { margin-left: auto; ...

Read More
Showing 17541–17550 of 61,298 articles
Advertisements