// with用法,先从当前查找,当前对象没有属性时从上一级查找 const obj = { age: 18, name: '张三' } const address = '深圳' function test() { with(obj) { console.log(age, name, address) } } test()