码迷,mamicode.com
首页 > 编程语言 > 详细

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

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

标签:function   number   highest   return   button   

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函数返回两个数字中较大数的代码

标签:function   number   highest   return   button   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!