博客列表 >20190326-js基础1_作业

20190326-js基础1_作业

蛋炒饭的博客
蛋炒饭的博客原创
2019年03月26日 23:38:31646浏览

实例1,计算是否是闰年,能被4整除但不能被100整除的是闰年

      function run($year){
            if(($year%4==0) && ($year%100 != 0)){
                alert('是闰年');
            }else{
                alert('不是闰年');
            }
        }
        //alert();
        run(2004);

运行实例 »

点击 "运行实例" 按钮查看在线实例

实例 优秀(90-100)、良好(80-89)、良(70-79)、及格(60-69)、不及格(0-59

        function grade($score){
            if($score>=90 && $score<=100){
                alert('优秀');
            }else if($score>=80 && $score<=89){
                alert('良好');
            }else if($score>=70 && $score<=79){
                alert('良');
            }else if($score>=60 && $score<=69){
                alert('及格');
            }else if($score>=0 && $score<=59){
                alert('不及格');
            }else{
                alert('没考试');
            }
        }

        grade(65);

运行实例 »

点击 "运行实例" 按钮查看在线实例


声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议