随笔分类 - 前端歌谣ts-学习-2022
前端ts-学习-2022
摘要:export default {} abstract class Person { abstract name: string; abstract show(): string; showName() { console.log(this.show()); } } class Student ext
阅读全文
摘要:export default {} class GetNameClass { private _fullName: string = "倪妮"; // 需求:我们就想要在外部进行修改 _fullName 那怎么办? get fullName():string { console.log("我是get
阅读全文
摘要:export default {} class Person { public name: string; protected age: number; private sex: string; constructor(name: string, age: number, sex: string){
阅读全文
摘要:export default {} // static class StaticTest { static salary: string; static say():void { console.log("我们想要的工资是: " + this.salary); } } StaticTest.sala
阅读全文
摘要:export default {} class Person { name: string; age: number; constructor(name: string, age: number) { this.name = name; this.age = age; } sayHello(): v
阅读全文
摘要:export default {} class Person { name: string; age: number; constructor(name: string, age: number) { this.name = name; this.age = age; } sayHello(): v
阅读全文
摘要:export default {} type VoidFunc = () => void // 在类型别名中指定函数返回值为Void, 我们可以强行给它返回值 这个返回值是有效的 let func1: VoidFunc = function() { console.log("哈哈哈"); retur
阅读全文
摘要:export default {} let userInfo = { name: "邱淑贞", age: 18, song: "恨你太无情", marry: true, show: function() { this.marry = false; } } class Rectangle1 { w:
阅读全文
摘要:export default {} // 不使用函数重载 function add(a: number, b: number) { return a + b; } add(10, 20); function add2(a: string, b: string) { return a + b; } a
阅读全文