The JS function for math arithmetic

Source: Internet
Author: User

Random function; Moth.random ()
            // 3, the following through the loop to each element of the array assignment, random number.             //  math.random (); Can randomly 0~1 any number between  [0,1]            //  alert (Math.random ());                             /* integer between Random 0~10 (can be random to 0 but not at random), parseint (Math.random (              ) *) * /

Math.Abs (required value) to find absolute values

Math.max (x, Y, z) The maximum value can be multi-valued (only two values before JS3).
Math.min (x, Y, Z ...) to find the minimum value  can be multi-valued (only two values before JS3).

Examples are as follows:
        //Math.Abs (required value) to find absolute valuesAlert (Math.Abs (100));// -Alert (Math.Abs (-100));// -Alert (Math.Abs (100-300));// $/*----------------------------------------------------------------*/        //Math.max (x, Y, z) The maximum value can be multi-valued (only two values before JS3). Alert (Math.max (100, 300, 200));// $Alert (Math.max (-100,-110));//-100Alert (Math.max (-100,-100));//-100/*---------------------------------------------------------*/                //math.min (x, Y, Z ...) to find the minimum value can be multi-valued (only two values before JS3). Alert (math.min (100, 300, 200)); Alert (Math.min (-100,-110));//-100Alert (math.min (-100,-100));//-100

The JS function for math arithmetic

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.