This is the array of prices from which I want to remove all the values of “price~”(and Not price_enquire~) except for the filter of the price at the last or the latest. I can’t just pick the last index because there can be another filter at the last too like gende~male or anything e.t.c,
let prices = [
"price~960822 TO 8000000",
"price~1175308 TO 8000000",
"price_enquire~No",
"price~660541 TO 8000000",
"color~red"
]
The desired result I want
newArray=[
"price_enquire~No",
"price~660541 TO 8000000",
"color~red"
]
As the price~ at the last was the latest so Leaving that all the other old price~ should be removed.