I wanna sort object fields for iterated array index. For example:
const data = {
"all": 2,
"test1": 0,
"test": 2,
"test2": 0,
"test3": 0,
"test4": 0,
"test5": 0
};
const users = [ "test","test1","test2","test3","test4","test5"];
I wanna data object like this:
data = {
"all": 2,
"test": 2,
"test1": 0,
"test2": 0,
"test3": 0,
"test4": 0,
"test5": 0
}
How can i achieve this?