Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
TypeScript and JQuery sample
var Person = (function () {
function Person(name) {
this.name = name;
}
return Person;
})();
function greeter(person) {
return "hallo " + person.name;
}
var person = new Person("bert");
$(document).ready(function () {
var message = greeter(person);
$("#status")[0].innerHTML = message;
});
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
</head>
<body>
<script src="hello.js"></script>
<div id="status"></div>
</body>
</html>
/// <reference path="jquery.d.ts" />
class Person {
constructor(name:string)
{
this.name=name;
}
name: string;
}
function greeter (person:Person){
return "hallo "+person.name;
}
var person=new Person("bert");
$(document).ready(function(){
var message = greeter(person);
$("#status")[0].innerHTML=message;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment