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 create Expanding Cards using HTML, CSS, and JavaScript
In this tutorial, we will learn how to create Expanding Cards using HTML, CSS and JavaScript. Expanding cards provide an interactive way to display content with smooth animations and enhanced user experience. What are Expanding Cards? Expanding cards are interactive UI elements that scale up or reveal additional content when clicked. They are commonly used to display information in a compact format while providing an engaging way to access more details on demand. HTML Structure To create expanding cards, we need the following HTML elements: Card container element: Contains all cards ...
Read MoreImplement Green Screen Algorithm using JavaScript
The green screen algorithm, also known as the chromakey algorithm, replaces all green pixels in a foreground image with corresponding pixels from a background image. This technique is widely used in film and video production to composite subjects against different backgrounds. The algorithm works by analyzing each pixel's color values. When a pixel has more green than red and blue combined, it's considered part of the green screen and gets replaced with the corresponding pixel from the background image. Requirements This implementation uses the SimpleImage library for image manipulation. Include this script in your HTML: ...
Read MoreReturn correct value from recursive indexOf in JavaScript?
A computer pattern or idea called recursion is present in many programming languages, including JavaScript. It is a feature used to build a function that repeatedly calls itself, but with a smaller input each time, until the intended outcome of the code is realized. In this article, we will return the correct value from a recursive indexOf() function in JavaScript. Let's dive into the article for a better understanding. Understanding Recursive indexOf Implementation The position of the first occurrence of a value in a string or array is returned by the indexOf() method. -1 is returned by ...
Read MoreDelete all text up to a character in a URL- JavaScript?
This article explains how to use JavaScript's replace() method with regular expressions to delete all text up to a specific character in a URL. This technique is useful for extracting filenames, removing domain information, or cleaning URL strings. A regular expression (RegExp) is a pattern used to match character combinations in strings. In JavaScript, regular expressions are objects with properties and methods for pattern matching and text manipulation. The replace() Method The replace() method searches for a value or regular expression pattern in a string and returns a new string with the matched content replaced. The original ...
Read MoreReturn indexes of greatest values in an array in JavaScript
We are required to write a JavaScript function that takes in an array of Numbers. The array may contain more than one greatest element (i.e., repeating greatest element). We are required to write a JavaScript function that takes in one such array and returns all the indices of the greatest element. Using Array.reduce() Method This approach first finds the maximum value using Math.max(), then uses reduce() to collect all indices where the element equals the maximum value. const arr = [10, 5, 4, 10, 5, 10, 6]; const findGreatestIndices = arr => { ...
Read MoreFinding confusing number within an array in JavaScript
A number in an array is confusing if it becomes another number which is also present in the array after we rotate it by 180 degrees. When rotated, digits transform as follows: 0→0, 1→1, 6→9, 8→8, 9→6. Other digits (2, 3, 4, 5, 7) cannot be rotated to form valid numbers. Understanding Confusing Numbers For a number to be confusing: It must contain only the digits 0, 1, 6, 8, 9 When rotated 180 degrees, it must form a valid number within our range The rotated number must also be present in the array Example ...
Read MoreApplying a custom function to each corresponding element of two arrays using JavaScript
We need to write a JavaScript function that applies a custom callback function to corresponding elements of two arrays, creating a new array with the results. Problem We are required to write a JavaScript function that takes in a callback function (which takes in two arguments and returns a value) as the first argument and two arrays of essentially the same length as the second and third argument. Our function should construct and return a new array whose each corresponding element is the return value of the callback function if corresponding numbers of the input array are ...
Read Morecipher.update() Method in Node.js
The cipher.update() method is used to update the cipher with data according to the specified encoding format. It is one of the built-in methods provided by the Cipher class within the crypto module. If an input encoding is specified, the data argument is a string; otherwise, the data argument is a buffer. Syntax cipher.update(data, [inputEncoding], [outputEncoding]) Parameters The parameters are described as follows: data – The data to be encrypted. Can be a string or buffer. ...
Read MoreHow to load data from a server in React Native?
To load data from the server you can make use of the fetch API that is similar to XMLHttpRequest or any other networking APIs. It is very easy to make a request to the server using fetch. Take a look at the following code: fetch('https://jsonplaceholder.typicode.com/posts/1') .then((response) => response.json()) .then((responseJson) => console.log(responseJson)); In above code we are fetching the JSON file https://jsonplaceholder.typicode.com/posts/1 and printing the data to the console. The simplest call to fetch() API takes in one argument i.e the path you want to fetch and it returns a promise with ...
Read MoreHow to create Frame by Frame Animation using CSS and JavaScript?
Frame by frame animation is a technique used in animation to produce motion by displaying a series of static images which are sequentially displayed. The appearance of motion is achieved by displaying the images in rapid succession. The followings are needed before we go to create the frame by frame animation: A series of images (frames) A web page with CSS and JavaScript Approach The process of creating frame by frame animation using CSS and JavaScript is relatively simple: STEP 1 – First, you need to create ...
Read More