随笔分类 -  面试题

摘要:1. js是单线程的,自上而下顺序执行 2. 宏任务 微任务 js里有 seTimeout,setInterval,dom事件,ajax,Promise,process.nextTick(node.js才有的)等函数 Promise和async中的立即执行我们知道Promise中的异步体现在then 阅读全文
posted @ 2021-03-17 21:00 James2019 阅读(1948) 评论(0) 推荐(0) 编辑
摘要:事件冒泡:从一个最具体的的元素接收,然后逐级向上传播 可以形象地比喻为把一颗石头投入水中,泡泡会一直从水底冒出水面。 <ul id="father"> <li class="item1">aaaa</li> <li class="item2">bbb</li> <li class="item3">c 阅读全文
posted @ 2021-03-15 15:37 James2019 阅读(221) 评论(0) 推荐(0) 编辑
摘要:JavaScript是解释型语言,编译一行,执行一行 语法分析 ==》引擎检查你的代码有没有什么低级的语法错误 预编译 =》在内存中开辟一些空间,存放一些变量与函数 变量提升... 解释执行 ==》执行代码 . 阅读全文
posted @ 2021-03-04 18:44 James2019 阅读(73) 评论(0) 推荐(0) 编辑
摘要:面向对象(OOP) VS 函数式编程(FP) PK后 FP略胜出 知呼上有2篇讲的很好: https://zhuanlan.zhihu.com/p/57708956 https://zhuanlan.zhihu.com/p/53762529 阅读全文
posted @ 2021-02-23 11:24 James2019 阅读(331) 评论(0) 推荐(0) 编辑
摘要:原始用法: 1.回调函数 2.事件监听 3.发布/订阅 4.Promise 对象 常用promise如下: function get1(){ return new Promise((resolve,reject)=>{ setTimeout(()=>{resolve(1)},2000) }) } a 阅读全文
posted @ 2020-11-12 18:52 James2019 阅读(108) 评论(0) 推荐(0) 编辑
摘要:// vue 中的简单使用 clearTimeout(this.timeout) this.timeout = setTimeout(() => { this.searchData(keywords) // 开始搜索 }, 300) 详见:https://www.jianshu.com/p/f9f6 阅读全文
posted @ 2020-11-11 11:20 James2019 阅读(708) 评论(0) 推荐(0) 编辑
摘要:1、 通过jsonp跨域2、 document.domain + iframe跨域3、 location.hash + iframe4、 window.name + iframe跨域5、 postMessage跨域6、 跨域资源共享(CORS)7、 nginx代理跨域8、 nodejs中间件代理跨域 阅读全文
posted @ 2020-11-11 11:17 James2019 阅读(122) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示