It means that if n
, the argument passed to the function, is falsey, 2000 will be assigned to it.
Here, it's probably to allow callers to have the option of either passing an argument, or to not pass any at all and use 2000 as a default:
function delay(n){
n = n || 2000
console.log(n);
}
delay();
delay(500);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…