UPDATE
After reading a comment, I realized that Enum is not native to JavaScript but is actually part of TypeScript. I decided to keep the original title unchanged to help others who may also make the same mistake as me.
I am faced with a scenario where I have two enums that share the same keys but contain different values.
enum RowStates {
editing = 0,
sentToApproval,
approved
// ...
}
enum RowColors {
editing = '#ffffff',
sentToApproval = '#ffffcc',
approved = '#ccffb3'
// ...
}
As part of this scenario, I need to create a function for conversion:
function Convert(rowState) {
// What logic should be implemented here to determine and return the appropriate rowColor?
// While using a switch statement for rowState seems like a viable option, I wonder if there are other solutions available?
}