How to extend window to all edges in macOS?

Solution 1:

Go to System Preferences/Dock and use this setting.

Solution 2:

This works from macOS Sierra onwards:

Hold the option key down and double click on the edge of the window when oblique arrow sign appears.