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 filter an object depending on the field\'s value in JavaScript?
Filtering objects by field values is a common JavaScript operation used in web applications. This technique allows you to extract specific data from arrays of objects based on certain criteria, such as filtering products by brand or employees by department. Basic Syntax The most efficient way to filter objects is using the filter() method: const filteredArray = array.filter(item => item.fieldName === fieldValue); array − Collection of objects to filter filter() − JavaScript method that creates a new array with elements passing the test item − Current object being processed fieldName − Property name ...
Read MoreHow to Get Last Day of Previous Month from Date in Moment.JS?
When working with dates in JavaScript, it's common to need specific dates for calculations or validations. One such situation is determining the last day of the previous month from a given date. In this article, we'll learn how to get the last day of the previous month using Moment.js. Prerequisite Moment.js: Moment.js is a popular JavaScript library used to parse, validate, manipulate, and display dates and times in JavaScript. You can install Moment.js in your project via npm: npm install moment Approaches to Get Last Day of Previous Month Below are two ...
Read MoreHow To Show Only One V-Menu At A Time When Clicking To Show The Menu?
In Vuetify applications, showing only one v-menu at a time when clicking requires proper state management. This prevents multiple menus from being open simultaneously and provides better user experience. Understanding v-menu Behavior By default, v-menu components can open independently. To ensure only one menu is visible at a time, we need to control their state using Vue's data properties and watchers. Method 1: Using Individual State Control This approach manages each menu's state individually and closes others when one opens: ...
Read MoreHow to select all text in HTML text input when clicked using JavaScript?
In web development, it is often necessary to provide users with an intuitive and convenient way to select all text within an HTML text input field when they click on it. This feature can greatly enhance user experience, especially when dealing with lengthy or pre-filled input fields. In this article, we will explore how to achieve this functionality using JavaScript. What does Selecting All Text in HTML Text Input Mean? When a user clicks on an HTML text input field, we want the entire text within that field to be automatically selected, allowing the user to easily modify ...
Read MoreHow to Use Conditional Statements On Objects?
Conditional statements allow you to execute different code blocks based on object properties and values. In JavaScript, you can use if, if-else, and switch statements to make decisions based on object data. This article demonstrates how to apply conditional logic to JavaScript objects, checking their properties and values to control program flow. Using if Statement with Objects The if statement executes code when a condition evaluates to true. You can check object properties, existence, or values. Syntax if (condition) { // code to execute if condition is true } ...
Read MoreHow to send an email from JavaScript?
Sending emails from JavaScript is a common feature in most web applications. It allows you to automate notifications, send user-generated content, or facilitate communication with your users. We can use different methods like using Mailto protocol, sending emails with a server-side language, and implementing email sending through an API to send emails from JavaScript. In this article, we will explore all of these methods to send email using JavaScript. Basics of Sending Email Before implementing the email-sending feature using different libraries and methods we need to understand what are the basic requirements to send emails. At a high ...
Read MoreOptimising JavaScript Bundle Sizes: Strategies for Code Splitting and Lazy Loading
In today's digital landscape, web applications have become increasingly sophisticated, offering a wide range of features and functionalities to users. However, this evolution comes at a cost: larger JavaScript bundle sizes. When a user visits a website, the browser is responsible for downloading and executing the entire JavaScript bundle, which can be a time-consuming process. This results in slower load times, increased network usage, and, ultimately, a negative impact on the user experience. To address this challenge, developers have turned to various techniques to optimize JavaScript bundle sizes. Two popular strategies that have gained traction are code splitting and ...
Read MoreJavaScript program to count triplets with sum smaller than a given value
In this article, we will learn to count triplets with a sum smaller than a given value in JavaScript. Triplets in an array whose sum is less than a provided number is a popular problem in competitive coding and algorithm design. Problem Statement Given an array of integers and a target sum, we need to find the number of triplets (a, b, c) where the sum of three elements is less than the given value. Input: const arr = [5, 1, 3, 4, 7]; const sum = 12; Output: 4 ...
Read MoreHow to Create an Animated Typing Effect using typed.js
Overview Typed.js is a JavaScript animation library that creates realistic typing effects for web text. You can add it to your project via CDN, NPM, or Yarn. The library animates text by typing and deleting characters, simulating human typing behavior with customizable speed and effects. Syntax The basic syntax to create a Typed.js animation is: var typed = new Typed(selector, options); Where selector is the CSS selector (ID or class) of the target element, and options is an object containing configuration properties like strings, typing speed, and loop settings. Installation Add Typed.js to your project using ...
Read MoreJavaScript Program To Delete Alternate Nodes Of A Linked List
We will be writing a JavaScript program to delete alternate nodes of a linked list. We will be utilizing a while loop to traverse the linked list while keeping track of the current node. In each iteration, we will skip every second node by linking the current node directly to the node after the next one, effectively removing alternate nodes from the list. Approach Start traversing from the head node of the linked list. For each node, check if both current node and its next node exist. Skip ...
Read More