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 disable future dates in JavaScript Datepicker?
Disabling future dates in a JavaScript datepicker prevents users from selecting dates beyond today. This is commonly needed for applications like booking systems, report generators, or any form where only past or current dates are valid. Understanding the maxDate Property The maxDate property sets the maximum selectable date in a datepicker. By setting it to the current date, all future dates become disabled and unclickable. Example: jQuery UI Datepicker ...
Read MoreTitle Case A Sentence JavaScript
Let's say we are required to write a function that accepts a string and capitalizes the first letter of every word in that string and changes the case of all the remaining letters to lowercase. For example, if the input string is — hello world coding is very interesting The output should be — Hello World Coding Is Very Interesting Let's define a function capitaliseTitle() that takes in a string and capitalises the first letter of each word and returns the string — Using Split and Map Method ...
Read MoreJavaScript merge multiple Boolean arrays with the OR || operator
There are times when you need to merge multiple Boolean arrays into a single array in JavaScript. One common approach is to combine the corresponding elements from each array using the OR (||) operator. This operation returns true if at least one of the elements being compared is true; otherwise, it returns false. In this article, we'll learn how to merge multiple Boolean arrays into a single array using JavaScript, specifically by applying the OR operator on corresponding elements. Problem Definition We are given an array of arrays of Boolean values, like this: Input: const ...
Read MoreCheck for Subarray in the original array with 0 sum JavaScript
We are required to write a JavaScript function that takes in an array of Numbers with some positive and negative values. We are required to determine whether there exists a subarray in the original array whose net sum is 0 or not. Our function should return a boolean on this basis. Approach The approach here is simple. We iterate over the array using a for loop, calculate the cumulative sum up to that particular element. And if any point the cumulative becomes 0 or attains a value it has previously attained, then there exists a subarray with ...
Read MoreHow to design a modern Website?
Modern websites are responsive and the design works fine on multiple devices such as Desktop, Tablet, and Mobile. Also, websites these days do not follow the old font styles, many of them use Google fonts since it's easy to find a font-face matching your website's content and Google provides a lot of free fonts to choose from. Modern websites display beautifully formatted content on multiple devices such phones, tablets, and desktops. Also, nowadays Retina-ready logos help in keeping your logo amazing, no matter the resolution. Follow the below given steps and learn how to design a modern website: ...
Read MoreHow to replace all dots in a string using JavaScript?
In this tutorial, we will explore different ways to replace all dots in a string using JavaScript. While it's possible to remove all occurrences of dots manually with a for loop, JavaScript provides built-in methods that make this task much simpler. The two most popular methods for replacing all dots in a string are: Using the replaceAll() Method The replaceAll() method replaces all occurrences of a specified pattern with a replacement string. This is the most straightforward approach for replacing all dots. Syntax string.replaceAll(searchValue, replaceValue) Parameters searchValue ...
Read MorePlay video on canvas and preserve the last frame/image on HTML5 Canvas
You can play a video on an HTML5 canvas and preserve the last frame by continuously drawing the video frames onto the canvas. When the video ends, the last drawn frame remains visible on the canvas. HTML Structure First, create the HTML elements for the video and canvas: Your browser does not support the video tag. JavaScript Implementation Here's the corrected code to play video on canvas and preserve the last frame: ...
Read MoreUsage of CSS empty-cells property
The empty-cells property specifies whether borders and backgrounds should be displayed for empty table cells. This property only works when border-collapse is set to separate. Syntax empty-cells: show | hide | inherit; Values show - Default value. Borders and backgrounds are displayed for empty cells hide - Borders and backgrounds are hidden for empty cells inherit - Inherits the value from the parent element Example: Hiding Empty Cells table.empty { ...
Read MoreHow to create a form with multiple steps in JavaScript?
Creating multi-step forms improves user experience by breaking complex forms into manageable sections. This approach reduces form abandonment and makes data collection more organized. Complete Multi-Step Form Example Here's a complete implementation of a multi-step registration form with validation and progress indicators: * { box-sizing: border-box; } body { background-color: #f1f1f1; } #regForm { margin: 100px auto; ...
Read MoreWhen summing values from 2 arrays how can I cap the value in the new JavaScript array?
When working with arrays that represent RGB color values, you often need to add corresponding elements while ensuring the result doesn't exceed the maximum value of 255. This is a common requirement in graphics programming and color manipulation. Suppose we have two arrays, each containing three elements representing the red, green, and blue color values as integers. Our goal is to add the corresponding values to form a new RGB color array, capping any value that exceeds 255. Problem Statement We need to create a function that: Takes two arrays as input (representing RGB values) Adds ...
Read More