Java Script Basic functions

Source: Internet
Author: User

Math.random () is a pseudo-random double value that is randomly selected for a system that is greater than or equal to 0.0 and less than 1.0.

datetime function (requires variable invocation):
var b = new Date ();     //get current Time
B.gettime ();                 //get timestamp
b.getfullyear (),     &NBS P      //get year
B.getmonth () +1;         //get Month +11
B.getdate ()                 //get days
b.gethours ();               //get hours
b.getminutes ();         //get minutes
B.getseconds ();         //get seconds
B.getday ()  ;       &NBS P      //get Day of the week
B.getmilliseconds ();     //get milliseconds
Date ()   ;   & Nbsp;                //get Full Date

Mathematical functions (called with math):
ABS (x) the absolute value of the return Number.
Ceil (x) is rounded on the logarithm.
Floor (x) is rounded down with a logarithmic.
Round (x) rounds the number to the nearest Integer.
Max (x, Y) returns the highest value in X and Y.
Min (x, Y) returns the lowest value in X and Y.
The POW (x, y) returns the Y power of X.
sqrt (x) returns the square root of the Number.

var n=math.sprt (4)//give Four open square root, pay attention to the case of Math;

Java Script Basic functions

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.