虾皮新加坡前端一面二面三面凉经
看到都没有shopee 新加坡前端的面经,贡献一篇吧,仅供参考。
一面(8.27)
算法题1.:将数组字符串转换为数组。例子:'[1,[2],3]' , '[[1,2,3],4,5]', '[[],[],[]]', [[[]]]', [1,[2]]'等许多情况需要逐一考虑。当时脑袋没睡好,头比较晕,老是不能bug free,用了两方法依然不能全部通过。但最后依然给我过了。
2.手写compose 函数
3. 手写 apply还是call的实现。
二面(9.10, 因为回美上学推迟了一周)
1. 写一个merge函数。merge数据同时并且去重。
2. 加千分位。
console.log(merge([1,2,3], [2,3], [4,5,3])); // [1,2,3,4,5] 这里补充下 a,b,c,d,e 是对象。 a = {a: 1}, b = {b:1} , c = {c:2}, d = a, e = {a: 1}, console.log(merge([a,c], [b, c], [c, d, e])); //
* format numbers: add comma, e.g. 12345.678 -> 12,345.678 * @param {number} input * @return {string} console.log(format(12345.678)); // 12,345.678 console.log(format(0.1)); // 0.1
function T1() { this.name = 't1'; this.age = 19; } function T2() { this.name = 't2'; this.age = 19; return 19; } function T3() { this.name = 't3'; this.age = 19; return { name: 't', age: 20 }; } function T4() { this.name = 't4'; this.age = 19; } console.log(new T1()); // {name:'t1',age:19} console.log(new T2()); // console.log(new T3()); // T4.prototype = new T1(); T4.prototype.type = 'expert'; const t4 = new T4(); console.log(t4); // console.log(t4.type); // console.log(t4 instanceof T1); // console.log(t4 instanceof T2); // console.log(t4 instanceof T4); //
console.log('a'); setTimeout(() => { console.log('b'); }, 0); console.log('c'); new Promise((resolve) => { console.log('d'); resolve(2); }).then(() => { console.log('e'); setTimeout(() => { console.log('f') }, 100) }); console.log('g'); //
5.常规基础题:原型链的理解,new关键字干了什么,实现。以及事件队列(都是跟算法相关的问题)
6.反问。
三面(9.16)
1. 为什么选shopee
2. 影响最深的东西
3. 为什么选前端
4. 一道算法题:从一个巨长的字符串,一个keywords数组保存所有关键词keyword,把字符串里所有的 keyword 元素进行替换。
5. 优化,别的方法。
6. 反问。
看是否会有HR面吧。(三面挂,可能算法不是最优解?)。也算无缘啦~
总结:我面下来感觉虾皮很重视算法,基本不问项目和八股文,自我介绍都没有(hr应该要自我介绍了吧)。虽然都不太难。自己算法能力还是不太行,每次都要调试一下才能弄出来。