Home >Web Front-end >JS Tutorial >How to use the Number.MAX_VALUE attribute in JavaScript_Basic knowledge

How to use the Number.MAX_VALUE attribute in JavaScript_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 15:56:451978browse

The Number.MAX_VALUE property belongs to the static Number object. This represents the largest possible positive constant that JavaScript can work with.

This constant has an actual value of

201564114603685.jpg (249×35)

Grammar

The value can be accessed using the following syntax:

var val = Number.MAX_VALUE;

Example:

Here is an example of the use of attributes.

<html>
<head>
<script type="text/javascript">
<!--
function showValue()
{
  var val = Number.MAX_VALUE;

  alert("Value of Number.MAX_VALUE : " + val );
 
}
//-->
</script>
</head>
<body>
<p>Click the following to see the result:</p>
<form>
<input type="button" value="Click Me" onclick="showValue();" />
</form>
</body>
</html>

This will produce the following results:

201564114042327.jpg (473×35)

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