• Javascript---- 练习九(对象)


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title></title>
    </head>
    <body>
    <script type="text/javascript">
    /********************
    1.请为网吧做一套系统,用于凭借身份证号码检测一个人是否成年,成年则欢迎,不成年则请出。
    提示:new Date();获取时间
    string.sub();截取字符串
    ********************/

    /*var birth = '1992,09,20';
    var births = birth.split(",");

    var s = ((parseInt(births[0]))+18)+","+births[1]+","+births[2];
    var birthDay = new Date(s);
    console.log(birthDay);
    var nowDay = new Date();

    if(nowDay.getTime()>=birthDay.getTime()){
    alert("恭喜你!你已成年!");
    }
    else{
    alert("骚年,你还没成年");
    }
    */



    /********************
    2.用至少两种定义对象的方式来定义一辆车,车有对应的属性(例如有尺寸,颜色,马力)和方法(行驶,开车灯)
    (请至少写出4个属性,2种方法)
    ********************/
    /*
    var car = function(size,color,power){
    this.size = size;
    this.color = color;
    this.power = power;
    this.run = function(){
    console.log("running");
    }
    this.light = function(){
    console.log("lighting");
    }
    }

    var car1 = new car();
    car1.run();*/
    </script>
    </body>
    </html>

  • 相关阅读:
    Kubernetes 再深入一点点
    10分钟完成 mongodb replSet 部署
    网络篇
    p2p 打洞专场(转)
    Dockerfile 编写
    关于github 代码管理,协作开发
    Kubernetes 基于 ubuntu18.04 手工部署 (k8s)
    备忘 ubuntu ip 及 dns 的坑
    各种语言web性能简单对比测试
    vue 按需加载
  • 原文地址:https://www.cnblogs.com/SunlikeLWL/p/7240422.html
Copyright © 2020-2023  润新知