• [TypeScript] 0.First Example


    Create a greeter.ts file:

    class Student {
        fullname : string;
        constructor(public firstname, public middleinitial, public lastname) {
            this.fullname = firstname + " " + middleinitial + " " + lastname;
        }
    }
    
    interface Person {
        firstname: string;
        lastname: string;
    }
    
    function greeter(person : Person) {
        return "Hello, " + person.firstname + " " + person.lastname;
    }
    
    var user = new Student("Jane", "M.", "User");
    
    document.body.innerHTML = greeter(user);
    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    
    <script src="greeter.js"></script>
    </body>
    </html>

    Webstrom can add watcher to the ts file, it will auto convert to the javascript file.

  • 相关阅读:
    orm 锁 和 事务
    多表查询
    django 单表查询
    djgango装饰器
    几个SQL命令的使用
    怎么成为优秀的软件模型设计者?
    jbpm 工作流(二)
    Jbpm工作流(一)
    EJB 介绍
    JNDI 使用
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4350856.html
Copyright © 2020-2023  润新知