async function get() {
let res = await fetch(location.href);
console.log(res.headers.redirected);
res.headers.forEach(function (a, b) {
console.log(a + "---" + b);
})
console.log(await res.text());
}
get();
2021年3月11日木曜日
async function
2021年3月3日水曜日
2021年3月2日火曜日
async,await,Promise
function llnu() {
return new Promise(function (t1, t2) {
setTimeout(function () {
t1(JSON.stringify({ 1: 1, 2: 2, 3: 3, 4: 4, 5: 5 }));
}, 2000);
});
}
async function xxx() {
cb(await llnu());
}
function cb(e) {
console.log(e)
}
登録:
コメント (Atom)