Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to detect the browser's format for HTML input type date
HTML input elements with type="date" always use the ISO 8601 format (YYYY-MM-DD) internally, but browsers display dates according to the user's locale settings. Here's how to work with both formats. Understanding Date Input Formats The input[type="date"] element stores values in ISO format (YYYY-MM-DD) regardless of how the browser displays it to the user. The valueAsDate property provides a JavaScript Date object for easier manipulation. Getting Current Date in ISO Format Set Current Date function setCurrentDate() { const today = new Date().toISOString().substr(0, 10); document.getElementById('dateInput').value ...
Read MoreHow to style images with CSS?
CSS provides numerous properties to style and enhance images on web pages. You can control dimensions, transparency, borders, filters, and positioning to create visually appealing designs. Basic Image Styling Properties Common CSS properties for styling images include: width/height: Control image dimensions opacity: Set transparency (0 to 1) border: Add borders around images border-radius: Create rounded corners filter: Apply visual effects Setting Image Opacity The opacity property controls image transparency, with values from 0 (fully transparent) to 1 (fully opaque): ...
Read MoreJavaScript global Property
The global property in JavaScript returns true or false depending on whether the 'g' (global) modifier is set in a regular expression pattern. Syntax regexPattern.global Return Value Returns a boolean value: true - if the 'g' flag is set false - if the 'g' flag is not set Example: Checking Global Flag JavaScript Global Property JavaScript Global Property Example ...
Read MoreJavaScript program to update DOM
JavaScript is a powerful tool for dynamically updating the Document Object Model (DOM) of a web page. The Document Object Model (DOM) is an important part of web development that allows changing the structure, content, and style of a webpage. This article explains how to update the DOM using different methods and provides examples. Understanding the DOM DOM stands for Document Object Model. The DOM represents a webpage as a tree structure, where each element is a node. JavaScript allows developers to select, modify, and manipulate these elements in real time, making web pages dynamic and interactive. ...
Read MoreCombine objects and delete a property with JavaScript
We have the following array of objects that contains two objects and we are required to combine both objects into one and get rid of the chk property altogether: const err = [ { "chk" : true, "name": "test" }, { "chk" : true, "post": "test" } ]; ...
Read MoreExtract key value from a nested object in JavaScript?
Extracting keys from nested objects is a common requirement in JavaScript. This tutorial shows how to find the parent object and nested property that contains a specific value. Creating a Nested Object Let's start with a nested object containing teacher and subject information: var details = { "teacherDetails": { "teacherName": ["John", "David"] }, "subjectDetails": { "subjectName": ["MongoDB", "Java"] } } console.log("Nested object created:", ...
Read MoreJavaScript code to find nth term of a series - Arithmetic Progression (AP)
To find the nth term of an arithmetic progression in JavaScript, we need to write a function that calculates the nth term using the AP formula. In this article, we will explore how to find the nth term of an AP using JavaScript. We are required to write a JavaScript function that takes three parameters: the first two consecutive terms of an arithmetic progression, and the position n of the term we want to find. If the input is 2, 5, 7 (first term = 2, second term = 5, position = 7): Then the series will ...
Read MoreSort object array based on another array of keys - JavaScript
When working with arrays of objects in JavaScript, you may need to sort one array based on the order defined in another array. This is particularly useful when you have a reference array that defines the desired sorting order. Problem Statement Suppose we have two arrays like these: const arr1 = ['d', 'a', 'b', 'c']; const arr2 = [{a:1}, {c:3}, {d:4}, {b:2}]; console.log("Original arrays:"); console.log("arr1:", arr1); console.log("arr2:", arr2); Original arrays: arr1: [ 'd', 'a', 'b', 'c' ] arr2: [ { a: 1 }, { c: 3 }, { d: 4 }, { ...
Read MoreIs there a Boolean Typed Array in JavaScript?
In this tutorial, we will learn if there is a Boolean Typed Array in JavaScript. Typed Arrays are array-like objects that allow reading and writing raw binary data efficiently. They are particularly useful for handling large amounts of data like audio, video, or image processing, as they provide faster data transport compared to regular arrays. Since machines work with binary data (0s and 1s), typed arrays store information in binary format, making data transfer more efficient. Now come to the question - Is there a Boolean Typed Array in JavaScript? No, Boolean Typed Array does not exist. ...
Read MoreHow to set when the transition effect will start with JavaScript?
In this tutorial, we shall learn to set when the transition effect starts with JavaScript. To set when the transition effect will start, use the JavaScript transitionDelay property. To make interactive components, we go for transition effects. Here let us get deeper into the topic and understand how we can set the transition start. Using the Style transitionDelay Property With Style transitionDelay property, we can set or return when the transition effect starts. We can specify the transitionDelay value in seconds(s) or milliseconds(ms). The delay can be either negative, positive, or zero. The transition effect starts ...
Read More