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

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

看代码说结果

代码输出结果1

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

代码输出结果2

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

代码输出结果3

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

代码输出结果4

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

代码输出结果5

js
let myArray = {}
myArray['0'] = 'a'
myArray['1'] = 'b'
myArray.length = 2
console.log(...myArray)
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))
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]
[2, 3]
[2]

代码输出结果7

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

问答题

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

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

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

常见的宏任务与微任务

算法

中文数字转为阿拉伯数字

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

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

回溯算法

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