Math 객체의 max() 함수는 여러 개의 숫자를 허용하고 그 중 가장 큰 숫자를 반환합니다.
- 이 함수에 단일 숫자를 전달하면 동일한 결과가 반환됩니다.
- 그리고 인수를 전달하지 않으면 무한대가 반환됩니다.
구문
구문은 다음과 같습니다.
Math.max(48, 148, 3654);
예시
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.max(48, 148, 3654);
document.write("Maximum of the given numbers: "+result);
</script>
</body>
</html> 출력
Maximum of the given numbers: 3654