Expressions

Test code: 1 + 1. More code: 1 + {}.

Check out this function: (n : number) => n + 1

Statements

class c1 {
  x = 42;
  f() {
    return [1,2,3].map(n => n + this.x );
  }
}
new c1().f();
class c {
  x = 42;
  name = "Fred";
  f()
  {
    return this.name + this.x;
  }
}
new c().f();

Together with syntax highlighting (highlight.js)

class c {
  x = 42;
  name = "Fred";
  f()
  {
    return this.name + this.x;
  }
}
new c().f();
function f(n: number) {
  return 42;
}