Web Development Articles

Page 351 of 801

How to get the arccosine (in radians) of a number in JavaScript?

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

This tutorial will help you to find the arccosine in radians of a number in JavaScript. Cosine is the ratio of the adjacent side and the hypotenuse of the right-angled triangle. To get the cosine of a number, the Math.cos() function is used in JavaScript. The value returned will be between -1 and 1. The inverse of cosine is called arccosine. An angle's trigonometric arccosine value can be calculated using the Math.acos() method. This returns a value between 0 and π (pi). The input to acos() must be between -1 and 1 inclusive. The function returns the ...

Read More

Indent the first line of a paragraph in CSS

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 4K+ Views

Use the text-indent property to indent the first line of a paragraph. This property accepts values in pixels (px), centimeters (cm), percentages (%), or em units. Syntax text-indent: value; Parameters The text-indent property accepts the following values: Length values: px, em, cm, mm, in, pt, pc Percentage: Relative to the width of the containing block Keywords: inherit, initial, unset Example: Basic Text Indentation You can try to run the following code to indent the first line: ...

Read More

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

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 293 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

Usage of border property with CSS

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 90 Views

The border property in CSS is used to create visible borders around HTML elements. It's a shorthand property that combines border width, style, and color in a single declaration. Syntax border: width style color; Where: width - thickness in pixels, ems, or other units style - solid, dashed, dotted, double, etc. color - any valid CSS color value Example: Basic Border Usage Here's how to apply different border styles to images: ...

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 get the largest integer less than or equal to a number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 935 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 get the largest of zero or more numbers in JavaScript?

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

In this tutorial, we will look at how to get the largest of zero or more numbers in JavaScript. The maximum of multiple numbers can be found using different techniques. The first technique we will introduce is the Math.max() method. The second technique will be the for-loop method. Following are the methods to get the largest of zero or more numbers in JavaScript − Using the Math.max() Method We can use the Math.max() method to find the largest of many numbers. It returns the largest value from the given multiple values. The input parameters should be ...

Read More

How to get the tangent of a number in JavaScript?

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

In this tutorial, we will learn how to get the tangent of a number in JavaScript. The tangent of an angle is defined by the ratio of the length of the opposite side to the length of the adjacent side. It can also be defined as the ratio of sine and cosine function of an acute angle where the value of cosine function should not be zero. Mathematically: tan θ = opposite side / adjacent side also, tan θ = sin θ / cos θ Where θ = angle in radians The tangent of a ...

Read More

How to convert a negative number to a positive one in JavaScript?

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

This tutorial will teach us to convert negative numbers to positive ones. Sometimes, programmers need to perform operations with the unsigned value of a number, and in such cases, they need to convert negative numbers to positive numbers. We will explore three different methods to convert negative numbers to positive numbers in JavaScript: Using the Math.abs() Method Multiplying the negative number with -1 Using the Bitwise Not Operator Using the Math.abs() Method The Math.abs() method is the most commonly used approach. It ...

Read More

Regular expression to match numbers only in JavaScript?

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

In this tutorial, we will learn regular expressions to match numbers only in JavaScript. Data validation is essential for web applications. We often need to ensure users provide correct input — for example, phone numbers should contain only digits, or credit card fields should accept numbers only. Regular expressions provide a powerful way to validate and extract numeric data from strings. They use patterns to match specific character types and return the matched results. Understanding Regular Expression Patterns A regular expression consists of a pattern and optional modifiers. For matching numbers, we use: \d ...

Read More
Showing 3501–3510 of 8,010 articles
« Prev 1 349 350 351 352 353 801 Next »
Advertisements