Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 23 of 80

How to extract the number of minutes from current time in JavaScript?

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

JavaScript uses timestamps based on Unix time (milliseconds since January 1, 1970 UTC) to handle dates and times. While humans understand time in hours and minutes, JavaScript provides built-in methods to extract specific time components from Date objects. In this tutorial, we will learn how to extract the number of minutes from the current time in JavaScript using the getMinutes() method. Date Object Methods The JavaScript Date object provides several methods to extract time components: getHours() − Returns the current hour (0-23) in 24-hour format getMinutes() − Returns the current minutes (0-59) getSeconds() − Returns ...

Read More

How to get the arctangent of the quotient of its arguments in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 291 Views

In this tutorial, we will learn how to get the arctangent of the quotient of its arguments in JavaScript. The JavaScript Math object provides built-in methods for mathematical operations. The Math.atan2() method is particularly useful for calculating the angle between two points in a coordinate system. Following are the ways to find the arctangent of the quotient of its arguments in JavaScript. Using Math.atan2() Method The Math.atan2() method returns a numeric value between -π and π representing the angle (in radians) between the positive x-axis and the point (x, y). Note that the y-coordinate is passed ...

Read More

How to name JavaScript Identifiers?

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

In this tutorial, we will learn how to name JavaScript Identifiers. Identifiers in JavaScript are the names we give to variables, arrays, objects, functions, etc. We must give them unique names to identify them properly. There are specific rules we must follow when naming identifiers that are common to most programming languages. Rules for Naming Identifiers There are certain rules we have to follow before naming an identifier. A proper name helps the programmer to make the code more effective. The rules are the following: JavaScript identifier names should not start with ...

Read More

How to get the smallest integer greater than or equal to a number in JavaScript?

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

In this tutorial, we will learn how to get the smallest integer greater than or equal to a number in JavaScript. To get the smallest integer greater than or equal to a number, use the JavaScript Math.ceil() method. This method returns the smallest integer greater than or equal to a given number by rounding up to the nearest integer. The Math.ceil() method is a static function of the Math object and must be invoked as Math.ceil(). It always rounds numbers upward, making it perfect for finding the ceiling value of any number. Syntax Math.ceil(value) ...

Read More

How to include inline JavaScript inside an HTML page?

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

In this tutorial, we will learn how to include inline JavaScript inside an HTML page. Inline JavaScript allows you to write JavaScript code directly within HTML event attributes, making it useful for simple interactions without external script files. Using Inline JavaScript to Show an Alert Message One of the simplest ways to understand inline JavaScript is by using the alert method. The alert method opens a pop-up window containing a message. Inline JavaScript code is written within event attributes and executes when that event is triggered. Syntax // inline JavaScript within the onclick attribute of ...

Read More

How to set the inward offsets of the image border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 307 Views

In this tutorial, we will learn how to set the inward offsets of the image border with JavaScript. An image can be set in the border as a border image using CSS properties. The border image can be set using different parameters. To set the inward offsets of the image border, use the borderImageSlice property in JavaScript. We will see two different approaches to setting up the inward offsets of the image border with JavaScript − The borderImageSlice Property The setProperty Method Using the borderImageSlice Property ...

Read More

How to clone a Date object in JavaScript?

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

In this tutorial, we will learn to clone a Date object in JavaScript. We can create a new object of the Date class that contains the date and time according to the user's requirement. Sometimes, it needs to copy the date, which means cloning it. In such cases, users can use the different approaches given below. Also, we will learn to set the new time and date in the cloned date in this tutorial. Using the Date.getTime() Method Users can simply create the new object of the Date class and get the total number of milliseconds from ...

Read More

How to get the largest integer less than or equal to a number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 932 Views

In this tutorial, we will learn how to get the largest integer that can be less than or equal to a number in JavaScript. To get the largest integer less than or equal to a number, we use the Math.floor() method in JavaScript. It rounds down a number to its nearest integer towards the lower value, regardless of the decimal portion. Following are two ways to find the largest integer that can be less than or equal to a number in JavaScript. Using Math.floor() Method The Math.floor() method returns the greatest integer that is less than ...

Read More

How to count JavaScript array objects?

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

In this tutorial, we will learn to count JavaScript array objects. The array is the data structure containing the strings, numbers, objects, etc., in JavaScript. The object is the one kind of entity that contains properties and methods related to it. We can access the object's properties and invoke the object method using the object's references. Generally, To find the array length, we can use the array.length property and it returns the total number of elements that the array includes. But what if we need to count only object elements? Here, this tutorial has various approaches to counting ...

Read More

How can I get time and date since epoch in JavaScript?

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

In this tutorial, we will learn to get the date and time since epoch in JavaScript. Sometimes, programmers need to find the total number of milliseconds, seconds, days, or other time units from 1 January 1970 since the UNIX epoch started. The Unix epoch is the starting point (January 1, 1970, 00:00:00 UTC) used by most computer systems to measure time. JavaScript provides several methods to calculate time elapsed since this date. Using the Date() Constructor In this approach, we will learn to get the current date from the UNIX epoch that started on 1 January 1970. ...

Read More
Showing 221–230 of 793 articles
« Prev 1 21 22 23 24 25 80 Next »
Advertisements