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 by Shubham Vora
Page 23 of 80
How to extract the number of minutes from current time in JavaScript?
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 MoreHow to get the arctangent of the quotient of its arguments in JavaScript?
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 MoreHow to name JavaScript Identifiers?
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 MoreHow to get the smallest integer greater than or equal to a number in JavaScript?
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 MoreHow to include inline JavaScript inside an HTML page?
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 MoreHow to set the inward offsets of the image border with JavaScript?
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 MoreHow to clone a Date object in JavaScript?
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 MoreHow to get the largest integer less than or equal to a number in JavaScript?
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 MoreHow to count JavaScript array objects?
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 MoreHow can I get time and date since epoch in JavaScript?
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