美文网首页
constructor

constructor

作者: 你坤儿姐 | 来源:发表于2020-08-25 16:13 被阅读0次

    constructor

    翻译:构造者、构造器
    语法:object.constructor

    <script type="text/javascript">
    function employee(name,job,born){
      this.name=name;
      this.job=job;
      this.born=born;
    }
    var bill= new employee("Bill Gates","Engineer",1985);
    document.write(bill.constructor);
    </script>
    

    输出:
    function employee(name,job,born){
    this.name = name ;
    this.job = job;
    this.born = born;
    }
    模板字符串拼接

    var name = `Your name is $(first) $(last).`
    

    相关文章

      网友评论

          本文标题:constructor

          本文链接:https://www.haomeiwen.com/subject/wiayjktx.html