# 写出输出结果,并解释原因

# 第一题

var a = {n: 1}  
var b = a
a.x = a = {n: 2}  
console.log(a.x) 
console.log(b.x)

# 第二题

const person = {
  name: 'dazhi'
}

function sayHi(age) {
  return `${this.name} is ${age}`
}

console.log(sayHi.call(person, 18))
console.log(sayHi.bind(person, 18))

# 第三题

const colorConfig = {
  red: true,
  blue: false,
  green: true,
  black: true,
  yellow: false
}

const colors = ['pink', 'red', 'blue']

console.log(colorConfig.colors[1])
上次更新: 3/11/2020, 8:53:06 AM

关注作者公众号

一起学习成长

前端帮帮忙