Home >Web Front-end >JS Tutorial >Summary of common methods of JavaScript Math objects_javascript skills

Summary of common methods of JavaScript Math objects_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:03:201161browse

Math.abs(x): Returns the absolute value of the number

Math.ceil(x): round up

Math.floor(x): round down

Math.max(x,y): maximum value

Math.min(x,y): minimum value

Math.random(x): random number

Math.round(x): Round

Get a random number within the specified range

var x=Math.floor(Math.random()*(max-min+1))+min;

The above summary of common methods of JavaScript Math objects is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn