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 && x.FieldValue === fieldValue);
   
    console.log('RESULT1', result);
    if(result) {
     return true
    } else {
    return false;
    }
    
    
}