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

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

看代码说结果

代码输出结果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),h=[e];function p(t,k,r,d,E,c){return a(),i("div",null,h)}const y=s(l,[["render",p]]);export{o as __pageData,y as default};