RV.*_*RV. 4 javascript typescript reactjs angular
如何从Typescript中的给定变量检查是否有任何变量大于0?
如何重写下面的代码,使其更优雅/简洁?
checkIfNonZero():boolean{
const a=0;
const b=1;
const c=0;
const d=0;
//Regular way would be as below.
//How can this use some library instead of doing comparison for each variable
if(a>0 || b>0 || c>0 || d>0){
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
81 次 |
最近记录: |