What is the error with my deferred code

please mention my mistakes and what is the use of such functions in web development?