How do I wipe Nexus 4? I think I got virus and have no idea how to get rid of it.
Heyzap interstitial ads in every app

I think wiping phone will delete virus.

I have Nexus 4 with Android 4.3

Phone is not rooted but I am ready to root as I got virus without root.

PS I know about Factory Reset button

https://support.google.com/nexus/4/answer/2936226?hl=en
I am not sure if that is enough. I seen some ppl wipe phone from command line from PC. By uploading new firmware from PC. Is that different from Factory Reset button?
The reason is that I wish to delete virus that shows ads in Google Play, Desktop, etc
Factory Reset will delete all your data, and restore your phone as if it were brand new.

On the other hand, flashing a new ROM is one way to change another version (usually to a higher version or a custom ROM) of Android. In this case, data is retained, unless you do a full wipe, which is equivalent to a Factory Reset.

A Factory Reset is sufficient in your case.

Other questions:
What is hard reset and what is factory reset?