zoukankan      html  css  js  c++  java
  • 记录一次 字节跳动外包 前端面试的 旁听

    这个面试官问的题目比较开放,首先是自我介绍(一定要注意礼仪哦,工作年限,技术栈,最近写的项目,注意重点)

    1.首先问了在项目中的难点,遇到的坑

    (看你的思维逻辑,自学能力,会不会利用资源去找解决方案)

    2.通过你的简历问一些基础的问题 像vue3的 hooks、组合式Api ......

    以上的问题问得差不多就进入了在线笔试环节

    3.不确定参数个数求和(ES6语法)(面试官就喜欢问新技术)

                            sum(...arr){ 
    				let result = arr.reduce((t,c)=>{ 
    					return t+=c
    				}) 
    			},  
            
                           sum(1,3,5,8)
    

    4.第二个笔记题是写sleep 延时执行

                  sleep(time){
    				 return new Promise(res=>{
    					 setTimeout(()=>{
    						 res('22222222222')
    					 },time)
    				 })  
    			},
                  
            
                  外层有async               console.log(1111111111) await this.sleep(2000).then(res=>{ console.log(res) }) console.log(3333333333)

    5.五次执行有成功返回成功,五次失败返回失败

                      test(){
    				return new Promise((resolve,reject)=>{					
    					let errorTime = 0
    					let randomNum = 0 
    					let resultBool = false
    					const logic = () =>{
    						console.log('***********')
    						return new Promise((res)=>{
    							randomNum = Math.floor(Math.random()*5)	
    							if(randomNum < 4){
    								errorTime++
    								res(false)
    							}else{								 
    								resultBool = true
    								resolve(errorTime)
    							}
    						})
    					} 					
    					while(!resultBool && errorTime < 5){
    						logic().then(innerRes=>{
    							resultBool = innerRes
    						})	 
    					}
    					if(!resultBool && errorTime === 5){
    						reject(`5次失败-----${randomNum}`)
    					}
    				})			 
    			},              

                  this.test().then((res)=>{
                    console.log(`第${res+1}次是成功`,'@@@@@@@@@')
                  }).catch(err=>{
                    console.log(err,'#########')
                  })


                  

      

  • 相关阅读:
    城市的划入划出效果
    文本溢出省略解决笔记css
    长串英文数字强制折行解决办法css
    Poj 2352 Star
    树状数组(Binary Indexed Trees,二分索引树)
    二叉树的层次遍历
    Uva 107 The Cat in the Hat
    Uva 10336 Rank the Languages
    Uva 536 Tree Recovery
    Uva10701 Pre, in and post
  • 原文地址:https://www.cnblogs.com/daifuchao/p/15724070.html
Copyright © 2011-2022 走看看