滴滴一面(凉经)

var obj = { a: 1 }

var objCopy = obj;

objCopy.a = 2

obj.a ?

js基本数据类型

this指向

var name = 'window'

var person1 = {name: 'person1',foo1: function () {console.log(this.name)},

var name = 'window'

var person1 = {
    name: 'person1',
    foo1: function () {
        console.log(this.name)
    },

    foo2: () => console.log(this.name),   
    foo3: function () {
        return function () {
            console.log(this.name)
        }
    },
    foo4: function () {
        return () => {
            console.log(this.name)
        }
    }
}
person1.foo1();
person1.foo2();
person1.foo3();
person1.foo4();

promise

new Promise((resolve, reject) => {
    console.log('promise1') 
    resolve()
}).then(() => {
    console.log('promise2') 
})

console.log('start1') 


setTimeout(() => { 
    console.log('a')
}, 2000)

setTimeout(() => { 
    console.log('b')
}, 1000)

setTimeout(() => { 
    Promise.resolve().then(() => {
        console.log('promiseA')
    }).then(() => {
        console.log('promiseB')
    })
})
console.log('start2') 

Promise.resolve().then(() => { 
    console.log('promise88') 
    setTimeout(() => { 
        console.log(333)
    })
}).then(() => { 
    console.log('promise2')
    setTimeout(() => {  
        console.log(555)
    })
})

箭头函数与普通函数区别

算法题:数组的随机排序 (洗牌算法)

#我的实习求职记录#
全部评论

相关推荐

2 2 评论
分享
牛客网
牛客企业服务