Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use math.sqrt in vue

Shulou Source: shulou.com Published: 2022-06-01 04:00:58 10月25日 Update

This article mainly explains "how to use math.sqrt in vue". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "how to use math.sqrt in vue" together!

In vue, the "math.sqrt" method is used to return the square root of a number, which is a built-in method of math, and if the number is set to negative, the result is NaN, and the syntax is "math.sqrt(numeric value)."

Operating environment: Windows 10 system, Vue2.9.6 version, DELL G3 computer.

What is the use of math.sqrt in vue?

The sqrt() method returns the square root of a number.

The syntax is:

Math.sqrt(x)

If x is negative, NaN is returned.

Examples are as follows:

var a = Math.sqrt(0); var b = Math.sqrt(1); var c = Math.sqrt(9); var d = Math.sqrt(64); var e = Math.sqrt(-9);

Output:

0138NaN

Extended knowledge:

Math built-in methods

// Math built-in method// 1 random() returns a number from 0 to 1, excluding 1console.log (Math.random());// 2 round() returns a rounded number console.log (Math.round(1.6)); // 2// 3 abs()console.log (Math.abs(-2.566)); // 2.566// 4 floor()console.log (Math.floor(2.3)); // 2// 5 ceil()console.log (Math.ceil(2.1)); // 3// 6 max() minconsole.log (Math.max(1,2,3,7,8,9,5)); // 9console.log (Math.min(1,2,3,7,8,9,5)); // 1// 7 PIconsole.log (Math.PI); // 3.141592653589793// 8 pow(base, power) console.log (Math.pow(2,3)); 8// 9 sqrt() console.log (Math.sqrt(4)); // 2 Thank you for reading, the above is the content of "how to use math.sqrt in vue". After studying this article, I believe that everyone has a deeper understanding of how to use math.sqrt in vue. The specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Methods learning content square root numbers knowledge results grammar negative numbers rounding numbers that is base numbers ideas situations numerical values articles more environment computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Technology macOS MariaDB Shulou Information