会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Howhy Blogs
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
42
下一页
2025年12月3日
js 类型转换
摘要: 1、原始转数字: Boolean转数字:true :1 false: 0 null: 0 undefined: NaN []: 0 {}:NaN ' \r\t\n ': 0 ' 123\t ' :123 'anc':NaN 2、所有转Boolean: 这几种情况是false:0 null undef
阅读全文
posted @ 2025-12-03 14:00 howhy
阅读(15)
评论(0)
推荐(0)
2025年11月26日
自写new
摘要: function myNew(constructor, ...args) { // 参数验证 if (typeof constructor !== 'function') { throw new TypeError('myNew: First argument must be a function'
阅读全文
posted @ 2025-11-26 15:53 howhy
阅读(14)
评论(0)
推荐(0)
MyPromise
摘要: class MyPromise{ constructor(executor){ this.state='pending'; this.value=undefined; this.reason=undefined; this.onFulfilledCallbacks=[]; this.onReject
阅读全文
posted @ 2025-11-26 11:45 howhy
阅读(10)
评论(0)
推荐(0)
promise API
摘要: 1. Promise.all() 概念 等待所有 Promise 成功,或者任何一个 Promise 失败。 2. Promise.race() 概念 返回第一个 settled(完成或拒绝)的 Promise。 3. Promise.any() 概念 返回第一个成功的 Promise,如果所有 P
阅读全文
posted @ 2025-11-26 10:34 howhy
阅读(8)
评论(0)
推荐(0)
vue 依赖收集
摘要: let _curDependFun=null; class dependCls{ constructor(){ this.dependFuns=new Set(); } depend(){ _curDependFun && this.dependFuns.add(_curDependFun); }
阅读全文
posted @ 2025-11-26 09:34 howhy
阅读(32)
评论(0)
推荐(0)
js 类型转换
摘要: + 运算符的双重角色 JavaScript 中的 + 运算符有两个主要功能: 数字加法 字符串拼接 类型转换规则 1. 基本规则 当使用 + 运算符时,JavaScript 遵循以下优先级: 如果任一操作数是字符串,进行字符串拼接 否则,尝试将两个操作数转换为数字进行加法运算 对象到原始值的转换过程
阅读全文
posted @ 2025-11-26 09:24 howhy
阅读(15)
评论(0)
推荐(0)
2025年11月25日
js 柯里化
摘要: function curry(func) { return function curried(...args) { const context = this; // 如果参数数量足够,直接执行原函数 if (args.length >= func.length) { return func.appl
阅读全文
posted @ 2025-11-25 11:49 howhy
阅读(11)
评论(0)
推荐(0)
js 节流和防抖
摘要: 节流是指连续触发事件但在 n 秒内只执行一次函数。 使用场景 滚动加载更多 鼠标移动事件 按钮频繁点击 游戏中的按键处理 function throttle(func, delay, options = {}) { let timeoutId = null; let lastTime = 0; co
阅读全文
posted @ 2025-11-25 11:35 howhy
阅读(24)
评论(0)
推荐(0)
js自定义call apply bind
摘要: Function.prototype.myCall=function(context,...args){ context=context==null ? globalThis : Object(context); const fnKey=Symbol('fn'); context[fnKey]=th
阅读全文
posted @ 2025-11-25 11:29 howhy
阅读(12)
评论(0)
推荐(0)
2025年11月24日
js属性
摘要: 分类: 1、自身属性和原型链属性 2、字符串属性和Symbol属性 3、可枚举的属性和不可枚举的属性 for in :自身属性和原型链(可枚举)属性 Object.keys() Object.getOwnPropertyName:自身属性 Object.getOwnPropertySymbols :
阅读全文
posted @ 2025-11-24 17:11 howhy
阅读(8)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
42
下一页
公告