Viruses, Malware, Ransomware, Online Scams... All of these are annoyances... Up until they start making your computer go haywire and make you hand over your hard earned money.
Viruses can get in through a number of ways but the best way to tackle any virus is with a great antivirus and internet security program.
Antivirus programs block any files, or programs, that forcefully try to enter into your machine (kind of like a security chain on your front door). If you have no chain, you allow anything and everything to enter into your machine.
Get protected. Be safe.