会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
火星程序随记
https://github.com/PGYangel
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
3
4
5
6
7
8
下一页
2020年8月9日
前端面试题整理——作用域和闭包
摘要: 什么是闭包,闭包的表现形式: // 作用域应用的特殊情况,有两种表现: // 函数作为参数被传递 // 函数作为返回值被返回 // 函数作为返回值 function create() { let a = 100 return function () { console.log(a) } } let
阅读全文
posted @ 2020-08-09 10:41 火星_PGY
阅读(369)
评论(0)
推荐(0)
2020年8月8日
前端面试题整理——关于堆栈内存和闭包作用域的题
摘要: // 一个对象里面,属性名不能重复,属性名一般是字符串,数字属性名==字符串属性名 /* let a={},b='0',c=0; a[b]='abc'; a[c]='123' console.log(a[b]) */ //考点进一步深入提问:对象和数组的区别 /* let a={},b=Symbol
阅读全文
posted @ 2020-08-08 20:12 火星_PGY
阅读(320)
评论(0)
推荐(0)
前端面试题整理——普通函数和new函数
摘要: 下列代码的输出值: function A() { console.log(1) } function fn() { A = function () { console.log(2) } return this } fn.A=A fn.prototype = { A: () => { console.
阅读全文
posted @ 2020-08-08 20:03 火星_PGY
阅读(169)
评论(0)
推荐(0)
前端面试题整理——手写方法解析URL参数
摘要: //拆分字符串形式 function queryToObj() { const res = {} const search = location.search.substr(1);//去掉前面的“?” search.split('&').forEach(paramStr => { const arr
阅读全文
posted @ 2020-08-08 19:59 火星_PGY
阅读(578)
评论(0)
推荐(0)
前端面试题整理——手写flatern摊平数组
摘要: // flatern 是摊平数组 function flat(arr) { const isDeep = arr.some(item => item instanceof Array) if(!isDeep){ return arr } const result = Array.prototype.
阅读全文
posted @ 2020-08-08 19:55 火星_PGY
阅读(211)
评论(0)
推荐(0)
前端面试题整理——关于EventLoop(1)
摘要: 下面代码输出打印值顺序: async function async1(){ console.log('async1 start'); await async2(); console.log('async1 end'); } async function async2(){ console.log('
阅读全文
posted @ 2020-08-08 19:45 火星_PGY
阅读(242)
评论(0)
推荐(0)
前端面试题整理——关于面向对象(1)
摘要: 下列代码输出打印值: function Foo() { getName = function () { console.log(1); } return this; } Foo.getName = function () { console.log(2) } Foo.prototype.getNam
阅读全文
posted @ 2020-08-08 19:42 火星_PGY
阅读(230)
评论(0)
推荐(0)
前端面试题整理——数组去重
摘要: // 传统方式,遍历元素比较 function unique(arr) { const res = [] arr.forEach(item => { if (res.indexOf(item) < 0) { res.push(item) } }) return res } console.log(u
阅读全文
posted @ 2020-08-08 19:39 火星_PGY
阅读(139)
评论(0)
推荐(0)
前端面试题整理——手写AJAX
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>手写ajax</title> </head> <body> <script> const xhr = new XMLHttpRequest(); xhr.ope
阅读全文
posted @ 2020-08-08 19:35 火星_PGY
阅读(437)
评论(0)
推荐(0)
前端面试题整理——VUE双向绑定原理
摘要: VUE2.0和3.0数据双向绑定的原理,并说出其区别。 代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>vue2.0/3.0双向数据绑定原理</title> </head> <body> 姓名:<sp
阅读全文
posted @ 2020-08-08 18:34 火星_PGY
阅读(1416)
评论(0)
推荐(0)
上一页
1
···
3
4
5
6
7
8
下一页
公告