各位大哥,請教下怎樣在function外獲得 spent 的值?

function pingHost(host) {
session.pingHost(host, (error, target, sent, rcvd) => {
if (error) {
console.log(`failed`);
} else {
const spent = rcvd.getTime() - sent.getTime();
return spent;
}
})
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/244993.html
標籤:JavaScript
上一篇:Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter
