随笔分类 - 手写题
发布订阅者模式
摘要:class EventEmitter { // 补全代码 constructor(){ this.events = {} } on(eventName, callback){ //一个事件上注册多个回调函数 const callbacks = this.events[eventName] || []
五点骰子
摘要:.box5 { justify-content: space-between; } .box5 div { display: flex; flex-direction: column; justify-content: space-between; } 注意选择器的优先级 .box5 .center
字符串转驼峰
摘要:通过split将字符串分割成数组 -font-size //['', 'font', 'size'] font-size //['font', 'size'] function cssStyle2DomStyle(sName) { var arr = sName.split('-').filter(