ts 中 type 和 interface 的区别 ts 中 type 和 interface 的区别type 可以用于基本类型、联合类型、元组,但 interface 不能: // ✅ type 支持联合类型 type ID = string | number; // ✅ type 支持元组 type Point = [number, number]; // ❌ interface 不能直接定义联合类型 // interface ID = s 2025-04-02 typescript #typescript
proformance api 使用 proformance api 使用Performance API 介绍Performance API 是浏览器提供的 高精度性能监控接口,用于测量网页和应用的性能,包括 页面加载时间、资源加载情况、JavaScript 执行时间 等。 Performance API 主要用于: 分析页面加载时间(如 performance.timing) 监测资源加载情况(如 performance.getE 2025-04-02 深入 > 调试 #proformance
字符串去除多余的空格 字符串去除多余的空格function trimExtraSpaces(str) { return str.trim().replace(/\s+/g, " "); } console.log(trimExtraSpaces(" Hello World! ")); // "Hello World!" 2025-03-28 基础 #string