import{_ as s,o as a,c as n,R as l}from"./chunks/framework.a304f0f7.js";const A=JSON.parse('{"title":"【字节跳动】前端面试题总结","description":"","frontmatter":{},"headers":[],"relativePath":"article/【字节跳动】前端面试题总结.md","lastUpdated":1682252217000}'),p={name:"article/【字节跳动】前端面试题总结.md"},o=l(`

【字节跳动】前端面试题总结

看代码说结果

代码输出结果1

js
console.log(['1', '2', '3'].map(parseInt))
[1, NaN, NaN]

代码输出结果2

js
let [a = 1, b] = []
console.log(a, b)
1 undefined

代码输出结果3

js
Promise.resolve()
  .then(() => {
    Promise.resolve()
      .then(() => {
        console.log(1)
      })
      .then(() => {
        console.log(2)
      })
  })
  .then(() => {
    console.log(3)
  })
1 3 2

代码输出结果4

js
const obj = { 3: '3', 2: 2, 1: '1', name: 'name', age: 'age' }
console.log(Object.keys(obj))
['1', '2', '3', 'name', 'age']

代码输出结果5

js
let myArray = {}
myArray['0'] = 'a'
myArray['1'] = 'b'
myArray.length = 2
console.log(...myArray)

代码输出结果6

js
console.log([1, 2, 3, 4, 5].splice(1, 2, 3, 4, 5))
console.log([1, 2, 3, 4, 5].slice(1, 2, 3, 4, 5))
[2, 3]
[2]

代码输出结果7

js
console.log([].constructor === Array)
console.log(typeof [] === 'array')
console.log(typeof null === 'object')
console.log('' instanceof Object)
true
false
true
false

问答题

HTTP缓存的请求头与响应头有哪些

宏任务与微任务有哪些区别?简述他们的应用场景

宏任务与微任务优先级不同

常见的宏任务与微任务

算法

中文数字转为阿拉伯数字

给定一个字符串,返回该字符串的所有组合

js
输入 abc 
输出 ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']

回溯算法

`,36),e=[o];function r(c,t,y,D,i,C){return a(),n("div",null,e)}const d=s(p,[["render",r]]);export{A as __pageData,d as default};