会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Howhy Blogs
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
···
42
下一页
2026年1月20日
判断两个对象是否相同
摘要: const obj=[ {a:1,b:2}, {b:2,a:1}, {a:1,b:2}, {a:3,b:{c:11,d:4}}, {a:3,b:{d:4,c:1}} ] const newArr=[...obj]; function isObject(obj){ return obj!==null
阅读全文
posted @ 2026-01-20 13:57 howhy
阅读(9)
评论(0)
推荐(0)
2025年12月31日
js 动态拦截属性
摘要: function createProxy(value=0){ return new Proxy({},{ get(target,prop){ if(prop Symbol.toPrimitive){ return ()=>value; }else{ return createProxy(value+
阅读全文
posted @ 2025-12-31 15:46 howhy
阅读(42)
评论(0)
推荐(0)
js 通用动画
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document<
阅读全文
posted @ 2025-12-31 10:05 howhy
阅读(52)
评论(0)
推荐(0)
2025年12月30日
js groupby
摘要: const users=[ {name:'zhangsan',age:23,gender:'male'}, {name:'lisi',age:20,gender:'female'}, {name:'wangwu',age:18,gender:'male'}, {name:'zhaohu',age:1
阅读全文
posted @ 2025-12-30 10:31 howhy
阅读(26)
评论(0)
推荐(0)
2025年12月29日
js 防抖和节流
摘要: // 实现防抖函数 function debounce(fn, delay, immediate = false) { // 实现 let timer=null; let result=null; return function(...args){ if(timer){ clearTimeout(t
阅读全文
posted @ 2025-12-29 16:15 howhy
阅读(27)
评论(0)
推荐(0)
实现 instanceof 操作符
摘要: // 实现 instanceof 操作符 function myInstanceof(left, right) { // 实现 if(typeof right!=='function' || right.constructor null){ throw new Error('right must b
阅读全文
posted @ 2025-12-29 14:24 howhy
阅读(20)
评论(0)
推荐(0)
js 单例模式
摘要: class Singleton { // 1. 使用私有静态属性 static #instance = null; // 2. 防止直接 new constructor() { if (Singleton.#instance) { throw new Error('Use getInstance()
阅读全文
posted @ 2025-12-29 14:06 howhy
阅读(49)
评论(0)
推荐(0)
2025年12月26日
js 数组去重和扁平方法
摘要: // 实现多种数组去重方法 const arr = [1, 2, 2, 3, 4, 4, 5, 'a', 'a', 'b']; // 方法1:使用 Set console.log([...new Set(arr)]) // 方法2:使用 filter + indexOf let newArr=arr
阅读全文
posted @ 2025-12-26 16:31 howhy
阅读(33)
评论(0)
推荐(0)
js 继承方法
摘要: function Animal(name) { this.name = name; } Animal.prototype.speak = function() { console.log(this.name + ' makes a noise'); }; function Dog(name, bre
阅读全文
posted @ 2025-12-26 15:28 howhy
阅读(26)
评论(0)
推荐(0)
2025年12月25日
js new的过程实现
摘要: function myNew(constructor,...args){ if(typeof constructor!=='function'){ return new TypeError('constructor must be a function'); } const newObj=Objec
阅读全文
posted @ 2025-12-25 15:48 howhy
阅读(22)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
42
下一页
公告