腾讯19届前端实习生面试一面二面
刚腾讯一面...岗位是前端实习生
感觉凉了...
居然没凉,3月14日下午收到了电话,这次说是要做一个在线的笔试,就在qq上共享桌面给面试官看,然后做面试官给的两个题目
一面
时间3.13
自我介绍 Html5 React和vue的异同 vue双向绑定实现原理,从view->model?model->view? React diff算法 fiber React新版本(16之后)变化,新特性 判断数组的方法,es3和es5分别是什么 web存储相关(cookie,sessionStorage,localStorage) 事件模型 web性能优化 跨域问题,解决方法 iframe相关 异步,async/await,Promise内部存储原理 webpack loader和plugin的区别 快排和冒排排序,稳定与不稳定 一个排列组合问题,也可以说是递归问题:100级台阶,一次可以走2步或者走一步,有多少种走法 有好几个我都回答的不是很好 ... 一首凉凉送给自己
二面
时间3.14
有2个题目,题目要求如下:
请在规定的时间完成下面2道题目,要求功能正常,代码具有可读性。时间:19:40 ~ 21:00。 1. 页面内有一个正方形元素,实现对其拖拽和放下,需要考虑窗口的边界情况。 2.实现大整数相加算法,两个数用字符串模拟函数原型:function add(a, b) {} 要求:代码具备一定的可读性,不能查阅相关资料。
我提交的代码如下:
第一题:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> .box { width: 600px; height: 600px; background-color: grey; } .squre { background-color: red; width: 100px; height: 100px; position: absolute; } </style> </head> <body> <div class="box"> <div class="squre" id="squre"> </div> </div> </body> <script> var squre = document.getElementById('squre'); var xStart, yStart; var isMoved = false; // squre.addEventListener('click', e => move(e)); squre.addEventListener('mousedown', e => move(e)); squre.addEventListener('mousemove', e=> moving(e)); squre.addEventListener('mouseup', e => moved(e)); function move(e) { isMoved = true; var x = e.clientX; var y = e.clientY; console.log(x, y); } function moving(e) { if (isMoved) { var newX = e.clientX; var newY = e.clientY; console.log(newX, newY); if (newX <= 500 && newY <= 500) { squre.style.marginLeft = newX + 'px'; squre.style.marginTop = newY + 'px'; } } } function moved(e) { isMoved = false; } </script> </html>
第二题如下:
function add(a = '123', b= '111') { var value = ''; var arrA = a.split(''); var arrB = b.split(''); var num = 0;; while (arrA.length && arrB.length) { var newA = Number(arrA.pop()); var newB = Number(arrB.pop()); num = newA + newB; value += num % 10; } console.log(value); var newValue = value.split(''); newValue.reverse(); console.log(newValue); var final = ''; newValue.map(x => { final += x; }) console.log(final); return final; } console.log(123+111); add();
两个题目都因为时间有点紧,还有不少需要完善的(甚至忘记删除调试代码了...),第一题边界的准确距离判断,第二题返回的还是一个字符串,还需要处理一下
#前端工程师##实习##前端##腾讯#