How do you delete pop ups from ads and scams?

I think the best way is to install a reliable third-party software, usually this kind of software includes the function to prevent from ads and malware.