When I search for letters, my code below works well. However, when it comes to numbers like flat_number
, it gives me an error saying
flat.flat_number.toLowerCase is not a function
filteredList() {
return this.Flats.filter((flat) => {
return (
// I tried the commented code but it didn't work
// this.Flats.filter(flat_number => String(flat_number).includes(this.search)) ||
flat.buyer
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.flat_number //flat_number not working
.toLowerCase()
.includes(this.search.toLowerCase()) ||
flat.city
.toLowerCase()
.includes(this.search.toLowerCase())
);
});
},
Can anyone offer some help?