javascript - jQuery:基于常量值的验证,例如(+50 或 -50)具有相同货币的常量值
问题描述
有这样的要求,例如我需要将一个阈值与总值(计数)的总和进行比较,并且如果阈值+50 or -50
和所选记录具有相同的货币,则将根据阈值进行比较。需要做成功的验证。如果超过+50 or -50
不允许成功验证。
我尝试了以下验证,它通过+50
(通过)并在-50
(失败)验证中失败。
var theresholdVal = 50;
for (let i = 0; i < jsonData1.length; i++) {
for (let j = 0; j < jsonData2.length; j++) {
if (jsonData1[i]['Currency'] !== jsonData2[j]['Currency']) {
alert("Currency is mismatched, please select same currency!!!");
return false;
} else if (theresholdVal <= parseInt(countVal)) {
alert("Selected value is more thereshold value");
return false;
} else {
alert("Data matched successfully!!!");
}
}
}
解决方案
推荐阅读
- microsoft-edge - 这个弹出窗口是什么,我可以在我自己的应用程序中使用它吗?
- linux - 用于从 CSV 文件中删除重复项的 awk 或 Sed 命令
- oracle - Oracle SQL Developer 中的触发器
- angular - 为什么 scrollIntoView() 仅适用于视图参考?
- latex - 在 Latex 中的图形周围绘制框
- python - 如何对 wav 文件应用傅里叶变换
- javascript - 添加特定功能后我的网页拒绝加载如何解决
- raku - 如何传播和捕获 Raku 中另一个线程中抛出的错误?
- c# - C# 中的 ADODB 问题 - 怀疑问题是数据转换
- servicestack - 如何在服务堆栈异常中自定义 HTML 响应?