Summarize this article:

Sometimes a simple driver in your Mac's operating system will malfunction, leading your wifi to be disabled or inconsistent. Before moving around or purchasing a new router, try restarting your computer. The closer you are to your router, the stronger the signal will be. If you're having issues with your connection's consistency, moving closer to the router may solidify it for you. Especially if your router is on a different level of your location than you are (e.g., the second floor), you may notice connection issues. The same can go for if you aren't in the same room with nothing between your computer and the router unit. If your router is in a cabinet, try opening the cabinet doors. Anything from basic furniture to walls and appliances can interfere with a wifi signal. If you're getting poor results on your end even after aligning yourself directly with the router, try restarting it. Each router is unique, but in most cases, you can simply turn off (or unplug) the router's power source for a few seconds to do this. Your router should restart upon plugging it back in. Expect this process to take a minute or two. If all else fails, you can use your Ethernet cable to connect your Mac directly to the router. While this may be inconvenient from a location standpoint, you shouldn't have any problems with Internet connectivity while tethered to your router. If you're in a public location, you probably won't be able to connect via Ethernet--though some libraries and airports may allow you to do so.

Summary:
Restart your computer. Move closer to the router. Make sure there isn't anything between your computer and the router. Restart your router. Connect using an Ethernet cable if possible.