I have an if statement :
if (argList["foo"] === "bar" || argList === "bar"){
// some code
}
I want to know if there is a shorter or more elegant way to write this condition.
Why i write this statement like this ? I have a function called startTool(argList), and another called startCreate(argList).
mod.zsh_apiStartTool = function(argList, callback) {
// some code
if (argList["tool"] === "measure" || argList === "measure"){
//some code to start the tool
}
if (argList["tool"] === "scanning"|| argList === "scanning"){
// some code to start the tool
}
ZSH_JS_API_ERROR(callback);
return;
}
mod.zsh_apiStartCreate = function(argList, callback) {
// some code
if (argList["tool"] === "measure"){
mod.zsh_apiStartTool("measure")
}
if (argList["tool"] === "scanning"){
mod.zsh_apiStartTool("scanning");
}
ZSH_JS_API_ERROR(callback);
return;
}
So when i run into startTool from startCreate, my var isn't argList["foo"] === "bar" but argList === "bar"