PHP
$amount = 19.99 * 100;
$test2 = intVal($amount); $test3 = intVal("$amount"); a. echo $amount . "<br />\n"; b. echo $test2 . "<br />\n"; c. echo $test3 . "<br />\n"; Which one will output 1999?
$amount = 19.99 * 100;
$test2 = intVal($amount); $test3 = intVal("$amount"); a. echo $amount . "<br />\n"; b. echo $test2 . "<br />\n"; c. echo $test3 . "<br />\n"; Which one will output 1999?
Anonymous Quiz
4%
a
11%
b
7%
c
49%
ab
16%
ac
13%
bc
用 promise 实现休眠函数:
/**
* 定义休眠函数
* @param {number} ms 休眠时间,毫秒
*/
const sleep = ms => {
return new Promise(resolve => setTimeout(resolve({
success: true,
time: ms
}), ms));
};
/**
* 定义休眠函数
* @param {number} ms 休眠时间,毫秒
*/
const sleep = ms => {
return new Promise(resolve => setTimeout(resolve({
success: true,
time: ms
}), ms));
};
Forwarded from Qiu tengcheng
const fs = require('fs');
(function mainline() {
process.nextTick(() => {
console.log('A');
});
console.log('B');
setTimeout(() => {
console.log('C');
}, 5000);
setImmediate(() => {
console.log('D');
});
fs.readdir('./', 'utf8', (err, files) => {
console.log('E');
setTimeout(() => {
console.log('F');
}, 0);
setImmediate(() => {
console.log('G');
});
process.nextTick(() => {
console.log('H');
});
});
console.log('I');
})();
(function mainline() {
process.nextTick(() => {
console.log('A');
});
console.log('B');
setTimeout(() => {
console.log('C');
}, 5000);
setImmediate(() => {
console.log('D');
});
fs.readdir('./', 'utf8', (err, files) => {
console.log('E');
setTimeout(() => {
console.log('F');
}, 0);
setImmediate(() => {
console.log('G');
});
process.nextTick(() => {
console.log('H');
});
});
console.log('I');
})();
Forwarded from Qiu tengcheng
Study the following listing. Each logger statement consists of a single letter. Predict the order of the letters in the output based on your knowledge of the event loop.
Mike Burrows说:“这个世界上只有一种一致性算法,那就是_____(There is only one consensus protocol, and that's _____)”。
Anonymous Quiz
50%
Paxos
50%
Raft
Forwarded from xsw0