Typescript: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Created page with "= Introduction = TypeScript is a typed language which produces javascript. e.g. <syntaxhighlight lang="typescript"> let myString = "fred"; let myBoolean = true; function..."
 
Line 11: Line 11:
function createMessage(name:string) {
function createMessage(name:string) {


}
</syntaxhighlight>
Typescript supports classes and access modifiers
<syntaxhighlight lang="typescript">
class Person {
 
  name: string
  lastName: string
 
  public Person(name:string) {
      this.name = name;
  }
  public void setLastName(lastName: string) {
      this.lastName = lastName;
  }
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 23:23, 9 July 2020

Introduction

TypeScript is a typed language which produces javascript.

e.g.

let myString = "fred";
let myBoolean = true;

function createMessage(name:string) {

}

Typescript supports classes and access modifiers

class Person {
   
   name: string
   lastName: string
   
   public Person(name:string) {
       this.name = name;
   }

   public void setLastName(lastName: string) {
       this.lastName = lastName;
   }
}