TypeScript

http://www.typescriptlang.org/Playground/

 

TypeScript lets you write JavaScript the way you really want to.
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
Any browser.  Any host.  Any OS.  Open Source.

 

 

var Greeter = (function () {
    function Greeter(message) {
        this.greeting = message;
    }
    Greeter.prototype.greet = function () {
        return "Hello, " + this.greeting;
    };
    return Greeter;
})();
var greeter = new Greeter("world");
var button = document.createElement('button');
button.textContent = "Say Hello";
button.onclick = function () {
    alert(greeter.greet());
};
document.body.appendChild(button);

 

posted on 2015-11-20 11:13  freeliver54  阅读(415)  评论(0编辑  收藏  举报

导航