【发布时间】:2014-04-24 07:55:27
【问题描述】:
这是我的方法:
p.show = function(message, status, timer){
//do stuff
};
有没有办法,如果没有传入诸如 timer 之类的变量,可以为它们设置一个默认值,例如 true。
在 php 中我会这样做:
private function show(message, status, timer = true){
}
【问题讨论】:
-
请看一下这个答案:stackoverflow.com/questions/894860/…它对你有用吗?
-
@hjpotter92
|是位运算符...这与||逻辑或完全不同。
标签: javascript jquery