📣 黑五价提前开抢|VIP一年通行证5折,蓝莓、Offer多多同步特惠
回复: 2
跳转到指定楼层
上一主题 下一主题
收起左侧

阿里巴巴前端挂经

全局:

2019(4-6月) FrontEndEng 本科 实习@阿里巴巴 - 网上海投 - 技术电面 Onsite  | Fail | 其他

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
1. 前端常见跨域解决方案. Waral dи,
1、 通过jsonp跨域
2、 document.domain + iframe跨域. Χ
3、 location.hash + iframe
4、 window.name + iframe跨域
5、 postMessage跨域
6、 跨域资源共享(CORS)
7、 nginx代理跨域
8、 nodejs中间件代理跨域
9、 WebSocket协议跨域


. Χ
2.你提到了jsonp,它和json的区别是什么


其实json和jsonp本质上都是字符串,只是jsonp是外层包裹了一层函数。
jsonp的原理就是通过script的src,将函数作为src请求地址的参数来传递数据,所以jsonp只有get一种传输方式。.
下面是jsonp的数据交互,首先定义一个回调函数,定义dataType类型为jsonp,将函数作为参数传输给后台,它与json相比是多了一层函数。


. 1point3acres
3。如何知道jsonp后端的函数返回了?

就答了addeventlistener,然后面试官问还有别的吗,我说不知道,然后被科普了正则运算。。

..
4.前端里怎么添加类名:
. Χ
  1. select.classlist.add("xxx")
复制代码
follow-up 还有其他的吗?
  1. var classVal = document.getElementById("id").getAttribute("class");
  2. .1point3acres
  3. //删除的话
  4. classVal = classVal.replace("someClassName","");
  5. document.getElementById("id").setAttribute("class",classVal );

  6. //添加的话
  7. classVal = classVal.concat(" someClassName");
  8. document.getElementById("id").setAttribute("class",classVal );
复制代码



5.能不能添加一个功能,没有这个class的时候再加呢
  1. if($('div').is('.class')){
  2.     $('div').addClass('class');
  3. }
复制代码


还有吗?
  1. if (!p.classList.contains('classname')) {
  2.     p.className += ' ' + 'classname';
  3. }
复制代码
. .и
. 1point3acres.com

6.css垂直居中和水平居中
  1. 第一种. From 1point 3acres bbs
  2. #container{
  3.     position:relative;
  4. }

  5. #center{
    . Χ
  6.     width:100px;
  7.     height:100px;
  8.     position:absolute;
  9.     top:50%;
  10.     left:50%;
  11.     transform: translate(-50%,-50%);. check 1point3acres for more.
  12. }

  13. 第二种
  14. #container{
  15.     position:relative;
  16. }

  17. #center{. check 1point3acres for more.
  18.     width:100px;. Χ
  19.     height:100px;. 1point3acres.com
  20.     position:absolute;
  21.     top:50%;
  22.     left:50%;. 1point3acres
  23.     margin:-50px 0 0 -50px;
  24. }

  25. 第三种
  26. #container{
  27.     position:relative;
  28. }.google  и

  29. #center{
  30.     position:absolute;
  31.     margin:auto;
  32.     top:0;
  33.     bottom:0;. Χ
  34.     left:0;. From 1point 3acres bbs
  35.     right:0;
  36. }
  37. . 1point3acres.com
  38. 第四种 flex
  39. #container{
  40.     display:flex;
  41.     justify-content:center;
  42.     align-items: center;
    . 1point 3 acres
  43. }

复制代码
.1point3acres

7.怎么使一个边框有两种颜色?. 1point3acres
这题不会。。。到最后都没听懂什么意思,我说用border double,他问怎么double,我说没用过不知道。
8.嵌套的数组扁平化(多维数组变成一维数组)
  1. function parseArr(arr,res){.google  и
  2.     var i=0;. check 1point3acres for more.
  3.     for(i=0;i<arr.length;i++){
  4.         if(arr[i] instanceof Array){
  5.             parseArr(arr[i],res);.--
  6.         }else{
  7.             res.push(arr[i]);
  8.         }
  9.     }. 1point 3 acres
  10. }
复制代码


  1. var newArr=arr.toString().split(',').map(function(ele){
  2.     return +ele;-baidu 1point3acres
  3. });
复制代码

9.你提到了tostring(),为什么它可以把数组扁平化
真不知道,除了mdn上写tostring就是把所有object变成字符串

10.你简历上的一个网站怎么做移动端适配的?
对不起我没做这个。

11.用过react和vue吗?
没有,在谷歌实习用的polymer

12.google chrome怎么做测试的?
。。。一系列实习相关问题。。

最后被拒了,最迷的是被拒没有邮件,需要自己去系统查。
move on了。





补充内容 (2019-6-16 23:09):. Χ
我都挂了可怜我打了这么多代码加个米吧!!谢谢谢谢

评分

参与人数 6大米 +86 收起 理由
蜗牛和深海鱼 + 1 给你点个赞!
鲤墨然 + 2 很有用的信息!
admin + 80 重点是有代码!!
eggflower + 1 给你点个赞!
wilburjiang + 1 赞一个

查看全部评分


上一篇:阿里巴巴 电面 一面面经
下一篇:Airbnb 北京onsite
🔗
aiweiwei 2019-8-6 04:00:40 | 只看该作者
全局:
楼主是面的哪里的阿里巴巴职位呀
回复

使用道具 举报

🔗
 楼主| cecilianxf 2019-8-7 12:19:50 | 只看该作者
全局:
aiweiwei 发表于 2019-8-6 04:00
楼主是面的哪里的阿里巴巴职位呀

beijing,  字数字数字数字数
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表