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

Airwallex一面

全局:

2023(7-9月) 码农类General 本科 全职@airwallex - 内推 - 视频面试  | Fail | 其他

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

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

x
本帖最后由 lglanan2023 于 2023-10-20 18:02 编辑
. 1point3acres
1. 读代码,react中settimeout里调用setState,state如何变化。
  (react中的过期闭包问题:指因为闭包的生命周期长于其引用的变量的生命周期而导致的问题。)
  1. import React from 'react'
复制代码
2. 读代码,react组件函数中遇到while(true)死循环,页面会怎样?(大计算导致渲染阻塞;)

. Waral dи,3. promise相关题目,图片批量加载,超出最大加载限制进入等待。
  a. promise.all中,如果一个任务失败了,则全部任务失败。promise.allSettled,如果一个任务失败,也会等待所有任务都执行完成。
  1. import './style.css';

  2. const urls = [
  3.   'https://resources.matcha-jp.com/resize/720x2000/2020/04/23-101958.jpeg',. Χ
  4.   'https://twgreatdaily.com/images/elastic/54y/54yt93ABiuFnsJQVYn-e.jpg',
  5.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRil2a9Sy8VA3VcaMXSkHhfY4JwEJA2cH60axa1zjZQnqlkoVgH&usqp=CAU',
    . ----
  6.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcRnYzT9n2O334O9l0pNC6_OIDEZDCdPDgD0BeYbN3AYrF_AWKtG&usqp=CAU',. Χ
  7.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSg59FBCFkElCSPCSZeVz8asTpX1z49qsIeydd3_wqZxHtpN2dR&usqp=CAU',. 1point 3 acres
  8.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQ4F4ULhP6M08kTWCUE2csMKS-55y5-uZ1LJ3Bi_l9yob8gcUmP&usqp=CAU',
  9.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTE-vlPXWnLfef967S-4eN0q6c81JPkkp-SvKqKATbeo5FwU6eb&usqp=CAU',
  10.   'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTNspT9VbqTH9kgG3830MSQVsxX0FV8ZxzU8Gk5cNhzH9pDdxGR&usqp=CAU',
  11.   'https://static.newmobilelife.com/wp-content/uploads/2016/07/0wOSIGK-1024x576.jpg',.--
  12. ];. .и

  13. const sleep = (ms: number) =>
  14.   new Promise((resolve) => {. check 1point3acres for more.
  15.     window.setTimeout(resolve, ms);
  16.   });. ----

  17. const insertImg = async (url: string) => {
    . From 1point 3acres bbs
  18.   return new Promise((resolve, reject) => {
  19.     const img = document.createElement('img');
  20.     img.width = 200;
  21.     img.height = 200;
  22.     img.src = url;
  23. . From 1point 3acres bbs
  24.     img.addEventListener('load', async () => {
  25.       await sleep(2000); // Just for testing purpose and you can ignore it.
  26.       document.body.appendChild(img);
  27.       resolve(url);
  28.     });

  29.     img.addEventListener('error', () => {
  30.       reject();
  31.     });
  32.   });
  33. };

  34. /**
  35. * Write a main function to ...
  36. */
  37. function async sequenceRender(urls: string[]):void {
  38.   const queue = [];. 1point3acres.com
  39.   for (const url of urls) {
  40.     if (queue.length < 2) {
  41.       const p = insertImg(url);
  42.       queue.push(p)
  43.     } else {. Waral dи,
  44.       try {
  45.         await Promise.allSettled(queue);
  46.       } catch (err) {
  47.         console.log(err);
  48.       }
  49.       
  50.     }. 1point3acres
  51.    
  52.   }
  53. }
复制代码
4. 代码题:根据id找到子节点并返回完整路径
  1. class TreeNode {
  2.   id: string;
    . Waral dи,
  3.   children?: [];
  4.   constructure(id: string): void {
  5.     this.id = id;
  6.   }
  7. }
  8. function getPath(tree: TreeNode, id: string): string[] {
  9.   if (tree.id === id) {
  10.     return [tree.id];
  11.   }
  12.   if (tree.children) {. 1point 3 acres
  13.     for (const child of tree.children) {
  14.       let ans = getPath(child, id);
  15.       if (ans.length > 0) {
  16.         // 这里找到子节点存在目标,返回父节点id
  17.         return [tree.id, ...ans];
  18.       }. Waral dи,
  19.     }
  20.   }
  21.   return [];
  22. }

  23. // 当时的代码.--
  24. type Tree = {
  25.   id: string;.--
  26.   children?: Tree[];
  27. };
  28. . From 1point 3acres bbs
  29. const tree: Tree = {.--
  30.   id: '1',
  31.   children: [
  32.     {
  33.       id: '2',
  34.       children: [
  35.         {
  36.           id: '3',
  37.         },
  38.       ],
  39.     },
  40.     {
  41.       id: '4',
  42.     },
  43.     {
  44.       id: '5',. Χ
  45.       children: [.1point3acres
  46.         {
  47.           id: '6',
  48.         },
  49.         {
  50.           id: '7',
    .google  и
  51.           children: [
  52.             {
  53.               id: '8',
  54.             },-baidu 1point3acres
  55.             {.
  56.               id: '9',
  57.             },
  58.           ],
  59.         },
  60.       ],
  61.     },.--
  62.   ],.1point3acres
  63. };
  64. .1point3acres
  65. /** ..
  66. * @example
  67. * getPath(tree, '2') ==> ['1', '2']
  68. * getPath(tree, '3') ==> ['1', '2', '3']
  69. * getPath(tree, '9') ==> ['1', '5', '7', '9'].google  и
  70. * getPath(tree, '10') ==> []
  71. */

  72. const getPath = (tree: Tree, id: string) => {
  73.   const temp: string[] = [];
  74.   const result = [].1point3acres
  75.   function findNode(node: Tree, id: string) {
  76.     result.push(node.id);. 1point 3acres
  77.     if (node.id !== id && !node.children) {
  78.       return;
  79.     }
  80.     if (node.id === id) {
  81.       result = temp;
  82.     };
  83.     if (node.children) {. ----
  84.       for (let child of node.children) {
  85.         findNode(child, id);
  86.         result.pop();
  87.       }
  88.     }
  89.   }.--
  90.   findNode(tree, id);
  91.   return result;
  92. };

  93. // document.body.innerHTML = `The path is: ${getPath(tree, '9‘).join(', ')}`;
复制代码
5. 项目中的技术点:
  a. 大数据渲染优化
  b. 组件库建设,意义。

求米,谢谢大家~~

评分

参与人数 4大米 +5 收起 理由
小亩_otdjwmu + 1 赞一个
orz6699mxc + 2 欢迎分享你知道的情况,会给更多积分奖励!
CatherineBYEU + 1 赞一个
芒果啊啊 + 1 赞一个

查看全部评分


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

本版积分规则

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