typescript variables
// There are 3 basic types in Typescript var isDone: boolean = false; var age: number = 42; var myName: string = "Anders";
// Not sure which the type of the variable is
var notSure: any = true;
notSure = 23;
notSure = "maybe a string";
null vs undefined
// prints null
var emptyVariable = null;
console.log(emptyVariable);
// prints undefined
var newVariable;
console.log(newVariable);
collection
// list
var list: number[] = [1, 2, 3];
var list: Array<number> = [1, 2, 3];
'Web > Typescript' 카테고리의 다른 글
조건문 (conditions) (0) | 2017.03.21 |
---|---|
function concept (0) | 2017.03.21 |
Intro to Typescript (0) | 2017.03.20 |
ts vs js (0) | 2017.03.20 |
타입스크립트 소개 (0) | 2017.03.10 |