My website features a search input field where users can search for specific courses by name using filtering and the includes()
method. However, I am facing an issue where I need to apply three methods simultaneously: toLowerCase()
, toUpperCase()
, and trim()
.
GetFilteredCourses() {
return this.courses.filter(course => {
return course.title.toLowerCase().includes(this.searchTerm);
});
},
It is essential to include both toLowerCase()
and toUpperCase()
in order to handle different cases during searches. Removing these methods would result in users needing to enter searches with exact case sensitivity.