Explain the following with an example - Williamson ether synthesis.
Williamson ether synthesis: Williamson ether synthesis is a laboratory method to prepare symmetrical and unsymmetrical ethers by allowing alkyl halides to react with sodium alkoxides.
This reaction involves SN2 attack of the alkoxide ion on the alkyl halide. Better results are obtained in case of primary alkyl halides.
If the alkyl halide is secondary or tertiary, then elimination competes over substitution.