Front End Technology Articles

Page 322 of 652

Changing the npm start-script of Node.js

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

The start-script of a Node.js application consists of all the commands that will be used to perform specific tasks. When starting or initializing a Node.js project, there are predefined scripts that will be created for running the application. These scripts can be changed as per the need or demand of the project. Script commands are widely used for making different startup scripts of programs in both Node and React. npm start is used for executing a startup script without typing its execution command. Package.json File Structure The start script needs to be added in the package.json file. ...

Read More

send(), sendStatus() and json() method in Node.js

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

In Express.js, the send(), sendStatus(), and json() methods are essential for sending responses to clients. The send() method sends data in string format, json() sends data in JSON format with proper headers, and sendStatus() sends HTTP status codes with default status messages. Prerequisites Node.js installed Basic understanding of Express.js Installation Install the Express module using npm: npm install express Understanding sendStatus() Method The sendStatus() method sends an HTTP status code along with its default message. Common status codes include 200 (OK), 404 (Not Found), 201 (Created), ...

Read More

Achieving maximum possible pair sum in JavaScript

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 298 Views

The maximum possible pair sum is a traditional problem in Data Structures and Algorithms (DSA). In this problem, we calculate the sum of two elements (i.e., pairs) in an array such that the resulting sum is the maximum among all possible pair sums. For example, we have an array [1, 2, 3, 4]. The sum of the pair (3, 4) is 7, which is the maximum among all pair sums in the given array. Problem Statement We have given an array named nums[], and our task is to write a JavaScript program to achieve the maximum possible ...

Read More

Add number strings without using conversion library methods in JavaScript

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 317 Views

We are required to write a JavaScript program that adds two numbers represented as strings, without using any conversion library or built-in methods. For example, If the input number strings are '11' and '23', the output should be '34'. In JavaScript, a number is considered a string-represented number when the number is enclosed in single quotes ('number') or double quotes ("number"). For example: '123' or "456". If you use the typeof operator on such values, it will return the type as 'string'. Here are a few input and output scenarios that provide a better understanding of the given ...

Read More

How to print a number with commas as thousands of separators in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 8K+ Views

In this tutorial, we will look at a few ways to print a number with commas as thousands of separators in JavaScript and compare them to understand which one is suitable in a given context. Why do we do number formatting? In English, commas are used to separate numbers bigger than 999. Dot is the thousands separator in Germany. Sweden uses space. The separator is added after every three digits from the right. Let's briefly introduce the methods. Using the toLocaleString() Method Here, the built-in locale string method localizes the number format based on the country. ...

Read More

How can I store JavaScript objects in cookies?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 13K+ Views

This tutorial will teach us to store JavaScript objects into the cookies. The cookies are the information of website visitors stored in text files. There is a particular mechanism to store the cookies of users' browsers. When new visitors visit the website, the server generates the text and sends it to the user. After that, when users allow access to the web page to retrieve the cookies, the server stores all user information in the text files. Cookies store the user's search history or other information for a better experience. For example, Google stores the user's search history to ...

Read More

How can I round down a number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

This tutorial teaches us to round down a number in JavaScript. The meaning of the round-down number is "returning the integer which is equal to or less than the current float number". For example, if we round down the number 9.99, we get 9 as an output, and in the same way, for 8.01 we get 8 as an output. In simple terms, if you represent your current number in the number line, you must return the nearest integer that resides on the left side of the current number. In this tutorial, we will take a look at ...

Read More

How to add hours and minutes to a date with JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 12K+ Views

In this tutorial, we will learn how to add hours and minutes to a date with JavaScript. We have multiple methods to achieve this which are the following. Add hours using the setHours() Method. Add minutes using the setMinutes() Method. Add hours or minutes with the getTime() Method. Add hours using the setHours Method JavaScript date setHours() method sets the hours for a specified date according to local time. Syntax Following is the syntax to apply the setHours() method to add ...

Read More

How to play a multimedia file using JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we will learn how to play a multimedia file using JavaScript. The multimedia file is the audio and video files. The multimedia files can be of different formats. wav and mp3 are two examples of audio file formats, whereas mp4 and mkv are examples of video file formats. In HTML, multimedia files can be shown easily using different tags. We use the video tag for showing a video, and for audio, we use the audio tag. These two tags are quite similar, and many attributes are the same in both tags. The "src" attribute defines ...

Read More

How to show the number of links in a document with JavaScript?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 883 Views

We use the links property of the document object to show the number of links in a document with JavaScript. The document object, part of the DOM, corresponds to the current web page that the browser has loaded. It contains all the information about the condition of the browser as well as the web page. The links is a property of the document object that returns a list of all the hyperlinks present in the HTML document. A hyperlink may look something like this: "https://www.tutorialspoint.com/php" The links property of the document object lists all HTML ...

Read More
Showing 3211–3220 of 6,519 articles
« Prev 1 320 321 322 323 324 652 Next »
Advertisements