在JavaScript中,我需要知道所有对象项是否都设置为true.
如果我有以下对象:
var myObj = {title:true, name:true, email:false};
Run Code Online (Sandbox Code Playgroud)
我可以这样写:
if(myObj.title && myObj.name && myObj.email){
/*Some code */
};
Run Code Online (Sandbox Code Playgroud)
但我正在寻找最简单的方法来编写它.例如:
if(myObj all is true){
/*Some code */
};
Run Code Online (Sandbox Code Playgroud)
我可能有另外一个对象,里面有10-20个项目,并且需要知道是否所有都是真的.
我创建了唯一索引:
$table->unique(['owner_id', 'promoter_id']);
Run Code Online (Sandbox Code Playgroud)
现在我托盘放下它
$table->dropUnique(['owner_id', 'promoter_id']);
Run Code Online (Sandbox Code Playgroud)
一般错误:1553 无法删除索引“connections_owner_id_promoter_id_unique”:需要在外键约束中(SQL:alter table connections drop index connections_owner_id_promoter_id_unique)
另外,我之前尝试删除外键
$table->dropForeign('connections_promoter_id_foreign');
Run Code Online (Sandbox Code Playgroud)
但仍然没有结果
我有这样的事情:
$(function(){
init = {
actions :{
settings : [settings_title(), settings_time(), settings_category(), settings_design(), settings_registration()],
timer : [timer()]
}
};
Run Code Online (Sandbox Code Playgroud)
但我不希望所有这些函数在页面加载时立即运行,就在点击时:
$('.save').click(function(){
init.actions.settings[1];
});
Run Code Online (Sandbox Code Playgroud)
或者我错过了什么