0
{"data":[{"hotelfloorsid":"1","floorname":"Ground Floor"},{"hotelfloorsid":"2","floorname":"1st Floor"},{"hotelfloorsid":"9","floorname":"3rd Floor"}]}

I want to remove element from this array based on hotelfloorsid.

Jamshaid Sabir
  • 73
  • 2
  • 10

1 Answers1

1

Use filter to remove items from an array.

var data = //your object - e.g. {data:[array of data]};
var newData = data.data.filter(function(object) {
   return object.hotelfloorsid == 1; //only include rooms where hotelfloorsid is 1
});
Adam Jenkins
  • 51,445
  • 11
  • 72
  • 100