let isDown: boolean = true;
let age: number = 24; let age: number = 0b11000; let age: number = 0o28; let age: number = 0x18;
let name: string = 'cnplaman'; let name: string = "cnplaman";
let list: string[] = ['cnplaman', 'glpla']; let list: Array[string] = ["cnplaman", "glpla"]; let gender=['male','female',1,0]
let x: [string, number]; y = ['cnplaman', 24];//ok x = [24, 'cnplaman'];//fail
enume Color= {red, green, blue}; let c: Color = Color.red
let gender: string | number; gender = 'male' gender = 1
function fn(): void { console.log('hi, there.'); }
if(age > 18){ console.log('adult'); }
if(age > 18){ console.log('adult'); }else{ console.log('teenager') }
if(age > 18){ console.log('adult'); }else if(age > 24){ console.log('grownup') }else{ console.log('teenager') }
switch(gender){ 'male': console.log('you are male'); break; 'female': console.log('you are female'); break; default: console.log('not for sure'); break; }
function sum(x:number, y:number): number { return x + y; }
let sum = function(x:number, y:number): number { return x + y; }
let sum = (x:number, y:number) => x + y;
let gender=['male','female',1,0] for(let item of gender){ console.log(item) }
let gender=['male','female',1,0] for(let ind in gender){ console.log(ind) } //"0","1","2","3"