Code for "if filter exists, remove it"

I am new to JS and do not know how to find the answer to this:
Is there a method for checking if a filter exists, and if yes, removing it in google sheets using apps script?
Would be something like:

if (filterExists) = true {

Never mind, this worked:

let filterStatus = spreadsheet.getActiveRange().getFilter()
if(filterStatus) {