Tripadvisor interview question

How to prevent XSS?