Front End Technology Articles

Page 274 of 652

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

Stream writable.cork() and uncork() Method in Node.js

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

The writable.cork() method is used for forcing all written data to be buffered in memory. This buffered data will only be flushed when stream.uncork() or stream.end() methods are called. These methods are useful for optimizing performance by batching multiple write operations. Syntax cork() writable.cork() uncork() writable.uncork() Parameters Both methods take no parameters. The cork() method buffers subsequent write operations, while uncork() flushes the buffered data to the underlying destination. How It Works When cork() is called, all subsequent write operations are buffered in memory instead of being ...

Read More

Stream writable.writableLength Property in Node.js

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

The writable.writableLength property returns the number of bytes (or objects) in the queue waiting to be written. This property is useful for monitoring buffer status and understanding the backpressure in your writable streams. Syntax writable.writableLength How It Works The property counts data that is: Buffered in the internal queue Waiting to be processed by the _write() method Corked (temporarily held) in memory Data that has already been written or is currently being processed is not counted. Example 1: Basic Usage with Cork Create a file named writableLength.js and run ...

Read More

Stream writable.writableObjectMode Property in Node.js

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

The writable.writableObjectMode property is used to check whether a writable stream is operating in object mode. It returns true if object mode is enabled, false if disabled, or undefined if not explicitly set. Syntax writable.writableObjectMode Return Value Returns a boolean value or undefined: true - Object mode is enabled false - Object mode is explicitly disabled undefined - Object mode not set (default) Example 1: Stream with Object Mode Enabled // Program to demonstrate writable.writableObjectMode property // Importing the stream module const stream = require('stream'); // Creating a ...

Read More

Creating a Simple Calculator using HTML, CSS, and JavaScript

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

A student grade calculator is a web application that takes subject grades as input and calculates the overall percentage and letter grade. This interactive tool provides instant feedback on academic performance using HTML for structure, CSS for styling, and JavaScript for calculations. The percentage calculation formula is: Percentage = (Total Marks Scored / Total Maximum Marks) × 100 How It Works The calculator follows these steps: User enters marks for different subjects through HTML input fields JavaScript function retrieves and validates the input values ...

Read More

How to create a chart from JSON data using Fetch API in JavaScript?

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 5K+ Views

In this article, we will explore how to create a chart after fetching JSON data using JavaScript's Fetch API. We'll first fetch the data from a remote server, then use that data to create a visual chart using Chart.js library. What is the Fetch API? The Fetch API provides a modern interface for making HTTP requests and handling responses. It returns promises, making it easier to work with asynchronous data compared to older methods like XMLHttpRequest. Syntax const response = fetch(resource [, init]) Parameters resource − The URL ...

Read More

How to enable JavaScript in Chrome, Firefox, and Safari?

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

JavaScript has become an essential part of modern websites. Nearly every website requires JavaScript support to function properly. All major browsers include a setting to enable or disable JavaScript. When JavaScript is disabled, websites may not work correctly, preventing users from accessing important features and interactive elements. To ensure websites function properly, you need to enable JavaScript in your browser. Here's how to enable JavaScript in the three most popular browsers: Google Chrome Mozilla Firefox Safari Google Chrome Follow these steps to ...

Read More

Difference between addEventListener and on-click in JavaScript

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 1K+ Views

The addEventListener and the onclick event both listen for an event. Both these event methods record an event and execute a function based on that event whenever a button is clicked. Though there is a difference between how both these events work. In this article, we are going to explore the differences between the addEventListener and the onclick function in JavaScript. addEventListener Method The addEventListener method uses an event handler to attach it to the specified element. This method is more flexible and allows multiple event listeners on the same element. Syntax element.addEventListener(event, listener, ...

Read More

Difference Between Static and Const in JavaScript

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

Static variables can be defined as a class property that is used in a class and not on the class instance. This type of variable is stored in the data segment area of the memory. The value assigned to these types of variables is shared among every instance that is created in the class. We need to use the static keyword for creating any static entity like a static variable, static function, operators, properties, etc. The value of a static variable is set at the runtime of the application and serves as a global value for the whole application. ...

Read More

How does asynchronous code work in JavaScript?

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

In this article, we will be exploring how async code actually works in JavaScript, how it is initialized, and how it is executed and called. But before moving on let's look at what is synchronous code and how it is different from asynchronous code. Synchronous Code − Code executes line by line in order. Each operation must complete before the next one starts. The program waits for each task to finish. Asynchronous Code − ...

Read More
Showing 2731–2740 of 6,519 articles
« Prev 1 272 273 274 275 276 652 Next »
Advertisements