![](/img/trans.png)
[英]Why doesn't the shorthand arithmetic operator ++ after the variable name return 2 in the following statement?
[英]Using return in shorthand if statement doesn't work
我似乎無法理解為什么這樣做:
if(n < i)
{
functoin();
}
else
{
return;
}
雖然這不起作用:
(n < i) ? function() : return;
為什么速記if語句不起作用?
return
不能在表達式中使用。 也許你可以嘗試,
return (n < i) ? function() : undefined;
但是,只有你對每種情況都有一件事要做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.