Articles on Trending Technologies

Technical articles with clear explanations and examples

JavaScript display the result of a function as HTML?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 4K+ Views

In JavaScript, displaying the result of a function as HTML allows you to dynamically update webpage content based on calculations or user interactions. This is commonly achieved using DOM manipulation methods. A JavaScript function is a block of code that performs a specific task and can return a value. To display this returned value or result as HTML content, we use DOM methods like innerHTML and getElementById(). Syntax Basic function syntax in JavaScript: function functionName(parameter1, parameter2) { // code to be executed return result; } ...

Read More

How to remove all blank objects from an Object in JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 3K+ Views

In JavaScript, removing blank or empty values from an object is a common task when cleaning up data. This article explores different methods to filter out empty strings, null values, or undefined properties from objects. Sample Object with Empty Values Let's work with an object containing empty values that we want to remove: const details = { name: 'John', ...

Read More

Uncamelising a string in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 260 Views

We are required to write a JavaScript function that takes in a string as the first argument and a separator character as the second argument. The first string is guaranteed to be a camelCased string. The function should convert the case of the string by separating the words by the separator provided as the second argument. For example − If the input string is − const str = 'thisIsAString'; const separator = '_'; Then the output string should be − const output = 'this_is_a_string'; Using Custom Logic This ...

Read More

Evaluating a mathematical expression considering Operator Precedence in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 586 Views

This article demonstrates how to evaluate mathematical expressions in JavaScript while respecting operator precedence. We'll implement a parser that handles the four basic arithmetic operators (+, -, *, /) and follows the standard order of operations. Problem Statement We need to write a JavaScript function that takes a mathematical expression as a string and returns its numerical result. The function must support: Addition (+) Subtraction (-) Multiplication (*) Division (/) as floating-point division The key challenge is handling operator precedence: multiplication and division must be evaluated ...

Read More

script.createCachedData() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 235 Views

The script.createCachedData() method in Node.js creates a code cache for VM scripts, improving performance when executing the same script multiple times. This method is part of the vm module and generates cached bytecode that can be reused. Syntax script.createCachedData() Parameters This method takes no parameters. It creates cached data from the current script instance and returns a Buffer containing the cached bytecode. Return Value Returns a Buffer object containing the cached bytecode that can be used with the cachedData option when creating new script instances. Example 1: Basic Cached Data Creation ...

Read More

JavaScript: How to return True if the focus is on the browser tab page?

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 2K+ Views

In this article, we will learn to check if the browser tab page is focused and under use or not in JavaScript. This is mainly required to record the user's inactivity time on the app and then take any action upon it if required. Use Cases for Monitoring Browser Tab Focus Following are the use cases for monitoring browser tab focus and user inactivity: Prevent sending network requests if the page is not being used by the user as this reduces server traffic. Save server costs by reducing unnecessary resource ...

Read More

How to flip a Rectangle horizontally using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 592 Views

In this tutorial, we are going to learn how we can flip a Rectangle object horizontally 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. We can flip a rectangle object horizontally using the flipX property. Syntax new fabric.Rect({ flipX: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our ...

Read More

How to set the dash pattern of controlling corners of Text using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 203 Views

In this tutorial, we are going to learn how we can implement the dash pattern of controlling corners of Text using FabricJS. The controlling corners of an object allow us to scale, stretch or change its position. We can customize our controlling corners in many ways such as adding a specific colour to it, changing its size etc. We can also specify a dash pattern for the controlling corners by using the cornerDashArray property. Syntax new fabric.Text(text: String, { cornerDashArray: Array }: Object) Parameters text − This parameter accepts ...

Read More

How to scale a Line object to a given width using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 406 Views

In this tutorial, we are going to learn how to scale a Line object to a given width using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to scale a Line object to a given width we use the scaleToWidth method. Syntax ...

Read More

Visually improving a website using JavaScript?

Kalyan Mishra
Kalyan Mishra
Updated on 15-Mar-2026 649 Views

In this article, you will learn various techniques to make your website attractive and fast using JavaScript, which will increase user engagement and make your website more productive. What is JavaScript? JavaScript is a web development language used to add functionality and interactivity to websites. It makes websites dynamic, robust, faster, and more engaging. JavaScript is an interpreted scripting language that runs directly in web browsers without needing compilation, making it one of the most popular languages in modern software development. To develop a complete website, you need three fundamental technologies: HTML ...

Read More
Showing 16111–16120 of 61,297 articles
Advertisements