JavaScript Basics (method of math)

Source: Internet
Author: User
Tags abs pow

Math Method Math: Object data type;
math: {} is a key-value pair under window; The property is named Math, and the property value is an object
var obj = {a:1};console.log (OBJ.A); Console.log (window. Math);
1. Math.Abs (): Take absolute value;
Math.Abs ( -1.2)
2. Math.floor (): Rounding down 3. Math.ceil (): Rounding up 4. Math.max (): Take maximum value
Math.max (12,7,89,100,56,3)
5.math.min (): Takes a set number of the minimum value of 6. Math.random () take random number, range of values [0,1] 7.math.round (): Rounding Round rounding
take 60-90 of the random integer Math.Round (math.random () * (90-60) +60)
8. Take a random integer between m-n
Math.Round (Math.random () * (n-m) +m)
9.math.pow: Take power to the square
Math.pow (2,3)
10.MATH.SQRT (): Open square;
math.sqrt (+)

JavaScript Basics (method of math)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.