Tripadvisor Interview Question

How to prevent XSS?