首页 > 编程语言 > 详细

JavaScript使用Max函数返回两个数字中较大数的代码

时间:2015-04-06 18:53:43      阅读:250      评论:0      收藏:0      [点我收藏+]

JavaScript使用Max函数返回两个数字中较大数的代码。

JavaScript的Math对象带有一个max函数用于获取两个数字的较大数代码:


 <p id="demo"> Click the button to return the highest number of 5 and 10. </p> <button it</button> <script> function myFunction() { document.getElementById("demo").innerHTML=Math.max(5,10); } </script>


返回输出:10

codego.net代码节选


本文出自 “qinqingniwo” 博客,请务必保留此出处http://10078349.blog.51cto.com/10068349/1629231

JavaScript使用Max函数返回两个数字中较大数的代码

原文:http://10078349.blog.51cto.com/10068349/1629231

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!