async function async1(){
console.log('async1 start');
await async2();
console.log('async1 end')
}
async function async2(){
console.log('async2')
}
console.log('script start');
setTimeout(() => {
console.log('setTimeout')
}, 0);
async1();
new Promise((resolve) => {
console.log('promise1');
resolve();
}).then(() => {
console.log("promise2");
}).then(() => {
console.log("promise2_then")
});
function Foo() {
Foo.a = function () {
console.log(1)
}
this.a = function () {
console.log(2)
}
}
Foo.prototype.a = function () {
console.log(3)
}
Foo.a = function () {
console.log(4)
}
Foo.a()
let obj = new Foo()
obj.a()
Foo.a()
let a = 111,
b = '111'
let a = Symbol('111'),
b = Symbol('111')
let a = { key: '111' },
b = { key: '222' }
let c = {
[a]: 'a',
[b]: 'b'
}
console.log(c[a], c[b])
const obj = {
1: '2',
2: '3',
length: 2,
push: Array.prototype.push,
slice: Array.prototype.slice
}
obj.push(4)
obj.push(5)
console.log(obj)
function fn(o) {
o.url = 'https://www.baidu.com'
o = new Object()
o.url = 'https://www.google.com'
}
let o = new Object()
o.url = 'https://www.bing.com'
fn(o)
console.log(o.url)