Are you facing problem to get maximum number in JavaScript. here is very simple inbuilt function to get maximum of given numbers. the full code is given below to get the maximum of given numbers. This code check the maximum of 2,4,6,8 and gives the output 8.
Output:
Source Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript">
document.write("Maximum of numbers:<br>" )
document.write("2, 4, 6, 8:<br>");
document.write("Result is: " + Math.max(2,4,6,8))
</script>
</head>
<body>
</body>
</html>
0 comments:
Post a Comment