JSFiddle - React, Tailwind, and code Playground
JavaScript
function getUserName(id)
{
return "some user name based on id here";
}
function getClaimStatus(id)
{
return "some claim status based on id here";
}
function getClaimType(id)
{
return "some claim type based on id here";
}
function changeIdToString(id, user, claimStatusId, claimTypeId)
{
if (user !== null)
return getUserName(id)
else if (claimStatusId !== null)
return getClaimStatus(id)
else if (claimTypeId !== null)
return getClaimType(id);
else
return id;
}
alert(changeIdToString(100, "AssignedTo"));
alert(changeIdToString(100, null ,"ClaimStatusId"));
alert(changeIdToString(100, null, null, "ClaimTypeId"));