Input array:
["temp/1/Lounge/empty", "temp/1/Lounge/66,66,66,66,66,66,66,66,64,64,64,64…,64,64,64,64,64,64,64", "temp/2/Lounge/empty", "temp/3/Lounge/empty"]
I have a list of elements like the above. Each element consists of four parts separated by slashes ('/'). If the first three parts are identical and the fourth part is different for any two elements, I need to remove the one with 'empty' as the fourth part.
For example: If one item has 'empty' as the fourth part and another item has data like 66,64,...,64,64,64 as the fourth part, I should eliminate the one with 'empty' as the fourth part in the array.
The desired output should be:
["temp/1/Lounge/66,66,66,66,66,66,66,66,64,64,64,64…,64,64,64,64,64,64,64", "temp/2/Lounge/empty", "temp/3/Lounge/empty"]
I attempted to split the items in the array:
for(i=0;i<arr.length;i++){
stringType = message.split('/')[0];
day = message.split('/')[1] ; //day
room = message.split('/')[2] ;
settingData = message.split('/')[3] ;
}
Please assist me in comparing the elements and removing them from the array.