JSFiddle - React, Tailwind, and code Playground

by Leonardo Trimarchi

JavaScript

var doTheMatch = DoTheyMatchTheFieldsINeed('rr_taskbasedpayoutoption',315740003);
alert(doTheMatch);

function DoTheyMatchTheFieldsINeed(fieldName, fieldValue) {
    console.log('LEOS FIELDNAME', fieldName);
    console.log('LEOSFIELDVALUE', fieldValue);

    var TheFieldNamesAndValues = [
        { FieldName: 'rr_taskbasedpayoutoption', FieldValue: 315740003 },
        { FieldName: 'rr_variablepayoutaddonpricingmodel', FieldValue: 315740003 },
        { FieldName: 'rr_taskpayoutaddonoption', FieldValue: 315740003 },
        { FieldName: 'rr_variablepercentaddonselection', FieldValue: 315740002 }
    ];


    var result = TheFieldNamesAndValues.find(x => x.FieldName === fieldName && fieldValue);
    console.log('RESULT1', result);
    var result2 = (TheFieldNamesAndValues.some(result));
    console.log('RESULT2', result2);
    return result2;
}