在 Ruby 中,我可以使用 return if variable != 1
例如,不运行返回后的代码。我需要在 JS 中执行相同的操作,但我不想使用完整的 if (variable != 1) { My code here }
语句。
这可能吗?
最佳答案
将return
放在if
语句之后:
if (variable != 1) return;
// more code here
关于javascript - JS相当于Ruby的return if,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55202448/