JavaScript 中,num = num || 1 这种写法有哪些优缺点?
收起
加个括号看咯。num = (num || 1) ,num没值时默认值为1,还好吧,看你实际需要吧。 比if else 或switch简练而已
报告相同问题?