hard reset - hold down the power button and the home button at the same time until u see an apple
reset network settings - setings>general>reset>reset network settings
back up and restore - plug it into ur computer with an updated itunes running. hit "back up now" and then "restore iphone". once the phone is restored to factory settings set it up as new and test the wifi. if its working hit the "restore back up" button on ur computer to bring ur content back onto the device.
get device replaced - if the restore iphone>set up as new didnt fix the wifi then u have one of the defective wifi chips and should get ur device replaced.
follow the steps in order until one of them works.