var myname:string = ‘wzn‘ => "use strict"; var myname = ‘wzn‘;
var age:number = 13 => "use strict"; var age = 13;
var man:boolean = true => "use strict"; var man = true;
function test(): void{} => "use strict"; function test() { }
这个标示不需要任何返回值
function test(): string{ return ‘‘ } => "use strict"; function test() { return ‘‘; }
function test(name: string){} test(‘‘) => "use strict"; function test(name) { } test(‘‘);
class Person { name: string; age: number } var zhangsan: Person = new Person(); zhangsan.name = ‘zhangsna‘, zhangsan.age = 19
function test(a: string, b: string, c: string) { console.log(a); console.log(b); console.log(c); } test(‘xx‘, ‘yy‘, ‘zz‘)
function test(a: string, b: string, c: string=‘zina‘) { console.log(a); console.log(b); console.log(c); } test(‘xx‘, ‘yy‘)
function test(a: string, b?: string, c: string=‘zina‘) { console.log(a); console.log(b); console.log(c); }
function test(a: string, b?: string, c: string=‘zina‘) { console.log(a); console.log(b); console.log(c); } test(‘xx‘)
原文:https://www.cnblogs.com/wzndkj/p/11639222.html