11 2021 档案
摘要:// 类 class Greeter { greeting: string; constructor(message: string) { this.greeting = message; } greet() { return `Hello, ${this.greeting}`; } } const
阅读全文
摘要:interface LabeledValue { label?: string; // 可选属性 } function printLabel(labelObj: LabeledValue) { console.log(labelObj.label); } const myObj = { size:
阅读全文
摘要:const iaMale: boolean = true; // 布尔值 const myAge: number = 18; // 数字 const myName: string = 'tom'; // 字符串 const scores: number[] = [100, 90, 80]; // 数
阅读全文
摘要:类型变量,一个组件可以支持多种数据类型的数据 基础用法 function identity<T>(arg: T): T { return arg; } const output = identity('myString'); console.log(output); 泛型变量 function id
阅读全文
摘要:1.跨域是浏览器是浏览器的安全策略。协议、域名、端口号不同都会引起跨域。 2.html标签的src属性可以发起http请求,并不受跨域限制 服务端代码 服务端返回一段js执行代码,例如 func(data)。这段代码会在客户端执行 const http = require('http'); cons
阅读全文
摘要:查看帮助 brew -help 安装软件 brew install git 卸载软件 brew uninstall git 搜索软件 brew search git 显示已安装软件列表 brew list 更新 所有软件 brew update 更新某个软件 brew update git 显示软件
阅读全文