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 invoke a function with its arguments transformed in JavaScript?
In JavaScript, we can create functions that take other functions as arguments and invoke them with transformed arguments. This is a powerful technique that can be used to create higher-order functions, which can take a function and return a new function with different behavior. What are Transforming Function Arguments To transform function arguments, we can use several approaches including the built-in methods map() and reduce(), or create custom transformation functions. These methods can be used on arrays to transform the elements in the array, and we can use them on functions to transform the arguments that are passed ...
Read MoreHow to check which tab is active using Material UI?
Material-UI provides a variety of components that help us build user interfaces with a consistent look and feel. One of the components that Material-UI provides is the Tabs component, which allows us to create tabbed interfaces in our applications. In this tutorial, we will learn how to check which tab is active using Material-UI, a popular React UI library. Use the useState Hook to Check Which Tab is Active Users can follow the steps below to check which tab is active using Material UI. Step 1 − First, users need to install Material-UI. We can do this ...
Read MoreES6/ECMA6 template literals not working in JavaScript?
Template literals are a powerful feature of ES6 JavaScript that use backticks (`) instead of quotes. However, they may not work due to browser compatibility, syntax errors, or incorrect usage. This article covers common issues with template literals and their solutions, helping you debug and properly implement this ES6 feature. What Are Template Literals? Template literals use backticks (`) instead of quotes and support multi-line strings and embedded expressions using ${expression} syntax. Syntax const str = `string value`; const interpolated = `Hello ${name}!`; Common Issues and Solutions Issue 1: Browser Compatibility ...
Read MoreMultiply only specific value in a JavaScript object?
The ability to multiply only specific values in a JavaScript object can be a useful tool for performing calculations or making modifications to data. By using methods like map(), forEach(), and traditional loops, you can efficiently target and modify values that meet certain criteria. An object in JavaScript is a separate entity having properties and a type. This article demonstrates various approaches to selectively multiply values within objects and arrays. Method 1: Using Array.map() to Transform Object Properties In this example, we multiply the value property of each object in an array by 3: ...
Read MoreFinding the missing number in an arithmetic progression sequence in JavaScript
An arithmetic progression (AP) or arithmetic sequence is a sequence of numbers where the difference between consecutive terms is constant. For example, the sequence 5, 7, 9, 11, 13... has a common difference of 2. When we have an array representing elements of an arithmetic progression with one missing number, we need to find that missing element efficiently. The key is to determine the common difference and locate where the sequence breaks. Problem Example Given an array like: const arr = [7, 13, 19, 31, 37, 43]; The missing number is 25, which ...
Read MoreCalculate the value of (m)1/n in JavaScript
In JavaScript, calculating the nth root of a number (m^(1/n)) is a common mathematical operation used in various applications. The nth root is the inverse of exponentiation - for example, the cube root of 27 is 3 because 3³ = 27. Understanding the nth Root The nth root of a number m is written as m^(1/n), where: m is the base number n is the root degree The result is the number that, when raised to the power n, equals m Syntax Math.pow(base, exponent) // For nth root: Math.pow(m, 1/n) Using ...
Read Morecipher.final() Method in Node.js
The cipher.final() method in Node.js returns the remaining encrypted data after all input has been processed through cipher.update(). This method completes the encryption process and can only be called once per cipher instance. Syntax cipher.final([outputEncoding]) Parameters outputEncoding – Optional string parameter specifying the output format. Common values include 'hex', 'base64', 'latin1'. If not provided, returns a Buffer. Return Value Returns a Buffer containing the final encrypted data, or a string if outputEncoding is specified. Example 1: Basic Usage with Different Encodings // Importing ...
Read MoreHow to work with Alerts Dialog box in ReactNative?
The Alert component in React Native displays dialog boxes to users with a title, message, and buttons for user interaction. It's essential for getting user confirmation or displaying important information. Syntax Alert.alert(title, message, buttons, options) Parameters To work with Alert component you need to import it first: import { Alert } from 'react-native'; The Alert.alert() function takes four parameters: title (required): The title of the alert dialog message (optional): The message to display buttons (optional): Array ...
Read MoreHow to clone a canvas using FabricJS?
In this article, we are going to learn how to clone a canvas using FabricJS. We can clone a canvas instance by using the clone() method. Usually, this is useful when we want to send our canvas instance remotely to somewhere else, it is usually a good idea to send the canvas instance clone in JSON form instead of sending the image of the canvas. clone() method helps us create a clone of any canvas instance along with its objects. Syntax clone(callback: Function, propertiesToInclude: Array) Parameters ...
Read MoreHow to set the vertical scale factor of Rectangle using FabricJS?
In this tutorial, we are going to learn how to set the vertical scale factor of a Rectangle using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. Just as we can specify the position, colour, opacity and dimension of a rectangle object in the canvas, we can also set the vertical scale of a rectangle object. This can be done by using the scaleY property. ...
Read More