摘要: 1.首先了解 es5 中的类的实现与继承 // es5 中的类 function Persion(name, age) { this.name = name;// 属性 this.age = age; this.run = function () {// 实例方法,必须 new 这个实例之后才能调用 阅读全文
posted @ 2021-04-11 22:37 张_Ning 阅读(68) 评论(0) 推荐(0) 编辑
摘要: // 函数的定义 /*// es5 函数声明 function run() { return 'run' } // 匿名函数定义 let run2 = function () { return 'run2' }*/ // 1.ts 函数声明,指定返回值类型 function run11(): str 阅读全文
posted @ 2021-04-11 16:04 张_Ning 阅读(45) 评论(0) 推荐(0) 编辑
摘要: /* typeScript 中的数据类型 boolean number string array tuple 元组类型 enum 枚举类型 any 任意类型 null 和 undefined void 类型 never 类型 */ let str: string = '你好' // str = 1 阅读全文
posted @ 2021-04-11 14:58 张_Ning 阅读(55) 评论(0) 推荐(0) 编辑