摘要:
const number = test || 0; 当test值为truthy时,取test的值,否则取0。这样可以避免number被赋为NaN、null、undefined、false等值。 const number = test && test.value; 当test值为truthy时,再去取 阅读全文
摘要:
function shuffle(arr) { for(let i = 0; i < arr.length; i++){ let randomIndex = Math.floor(Math.random() * (i + 1)) let item = arr[randomIndex] arr[ran 阅读全文